I have a window that show the result of multiple worker threads, but my worker threads should work with no interrupt(almost) so I want to post my notification data to the main window, I’m currently using BeginInvoke but it has a problem! I should call EndInvoke but where? I should create another thread just to service this? another option is using PostMessage directly but since I’m learning to work with .NET I prefer a .NET solution instead of a platform call(if available). So what should I do here to post something to main thread without blocking my worker threads?
I have a window that show the result of multiple worker threads, but my
Share
You should simply use
BeginInvoke, which is the direct equivalent of posting a message. You don’t need to callEndInvokeat all unless you are interested in the return value.If you are interested in the return value then the answer to “where do I cann
EndInvoke” is kind of obvious: call it at the last moment before you need the return value in order to proceed.