Multithreaded events in dll to prevent blocking

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a synchronous socket dll which fires several events to a winforms
client.
The winform calls methods on the dll and the dll fires an event back on the
same thread. I want the dll to fire events back on a different thread, but
am not sure how to go about this.

The dll has many events,, each event has different event arguments, so must
I create a thread for each event?

Without these threads, my winform app sometimes seems to "miss" the events
fired from the dll.

Can anyone guide me with some sample code? Perhaps a url demonstrating this?

Thanks
 
Opa said:
I have a synchronous socket dll which fires several events to a winforms
client.
The winform calls methods on the dll and the dll fires an event back on
the
same thread. I want the dll to fire events back on a different thread,
but
am not sure how to go about this.

Events are always fired on the same thread as the code raising the event. If
this might be a different thread from the one containing the message loop,
then the event handler must use Form.Invoke. Otherwise, you'll see the kind
of problem you've seen.

John Saunders
 
Back
Top