G
Guest
I have a multi-threaded class that I am creating that needs needs to raise
events when certain asynchronous events occur. I would always like the
events to be raised to the primary UI thread of any application that is using
my component. I can't just call raiseevent from the thread that catches the
asynchronous data. (In this case from a serial port). This is because I
have a separate thread reading from the serial device. How can I marshall
the call such the event is raised on the primary UI thread?
My only solution right now is to use a Form Timer in the class and
repeatedly poll the thread to see if any events should be raised. Is there a
better way?
events when certain asynchronous events occur. I would always like the
events to be raised to the primary UI thread of any application that is using
my component. I can't just call raiseevent from the thread that catches the
asynchronous data. (In this case from a serial port). This is because I
have a separate thread reading from the serial device. How can I marshall
the call such the event is raised on the primary UI thread?
My only solution right now is to use a Form Timer in the class and
repeatedly poll the thread to see if any events should be raised. Is there a
better way?