Does the event code _have_ to run in Thread A, or do you just not want for
it to block thread B? If the former, you are going to have to come up with
some way to interrupt Thread A.
If the latter, you can just use another thread, or you can implicitly use
another thread by using the BeginInvoke capability of the delegate (causes
an event to be fired asynchronously).
Example (something like this, I haven't tried compiling):
Instead of this:
(Thread B firing the event):
if(this.MyEvent != null)
this.MyEvent(theParams)
You could do something like this (syntax might be off)
// this causes the event handler code to execute on a 3rd thread
if(this.MyEvent != null)
this.MyEvent.BeginInvoke(theParams);
"Bob Lazarchik" <bo*****@sditampa.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Hello:
I need to fire events between two threads. Any suggestions on the best
way to accomplish this. Scenerio:
Thread A is main thread. Thread B is a Com port listener that fires an
event when it receives input. I need to fire this event to Thread A yet
allow thread B to continue processing while thread A handles the event. I
have looked at using the Messaging classes but this looks like overkill to
accomplish this.
Any suggestions are greatly appreciated.
Thanks
Bob