PC Review


Reply
Thread Tools Rate Thread

Custom Event handling + thread handling.

 
 
Michael McCarthy
Guest
Posts: n/a
 
      13th Jun 2005
I've written an event that tells me that I've connected properly to a
remote telnet location. When I know that I'm connected I fire the event
which is being listened for in a bit of code that then goes on and does
some work based on this event.

My problem is that once I fire that event, the thread that fired it
waits until the thread that received it finishes. I fixed the problem
by making the bit of code that is listening for the event continue on
with what it is doing in the background, but I'm wondering if there is a
different way.

Specifically, the code is going through a csv file and then doing a few
things on a remote system to get information based on something in the
csv, and then processing that information once we get it.

Everything works fine, but I'd like to know what I'm doing wrong, in
that I don't think that the thread should be tied up waiting for
whatever was listening for the event to finish.

Any help, or pointing in the right direction is as usual, very much
appreciated.

regards,
M.
 
Reply With Quote
 
 
 
 
Garry Freemyer
Guest
Posts: n/a
 
      14th Jun 2005
Hmmm. I was working on events on my screensaver, and I utilize events and I
noticed that the program output mentions that a separate thread that handles
events. I think it called it the NetEvent thread, which confirmed my
suspicion that events are handled on a separate thread.

My suggestion is to create a worker thread to start the event running, and
then when it is done, have the thread end.



"Michael McCarthy" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I've written an event that tells me that I've connected properly to a
> remote telnet location. When I know that I'm connected I fire the event
> which is being listened for in a bit of code that then goes on and does
> some work based on this event.
>
> My problem is that once I fire that event, the thread that fired it waits
> until the thread that received it finishes. I fixed the problem by making
> the bit of code that is listening for the event continue on with what it
> is doing in the background, but I'm wondering if there is a different way.
>
> Specifically, the code is going through a csv file and then doing a few
> things on a remote system to get information based on something in the
> csv, and then processing that information once we get it.
>
> Everything works fine, but I'd like to know what I'm doing wrong, in that
> I don't think that the thread should be tied up waiting for whatever was
> listening for the event to finish.
>
> Any help, or pointing in the right direction is as usual, very much
> appreciated.
>
> regards,
> M.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any easy scheme for handling event from another thread thanthe UI? Sin Jeong-hun Microsoft C# .NET 4 6th Jun 2008 03:07 PM
Custom Created Event Handling =?Utf-8?B?c3J1amFu?= Microsoft Dot NET 0 31st Jan 2006 06:01 PM
Custom event handling VJ Microsoft VB .NET 5 15th Mar 2004 04:47 PM
Cross Thread Event Handling Rob P Microsoft C# .NET 1 8th Jan 2004 12:36 PM
NumericUpDown custom event handling? G Microsoft Dot NET Framework Forms 0 28th Oct 2003 06:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:00 AM.