In WinForms, you have Control.BeginInvoke()
, which means you can marshall a call from a background thread to the main UI thread that created the control's handle.
This is fine, but how (in C#) would you do this between two "standard" threads?
I have written a service bus, which has a processor thread to consume messages. I want a timer to fire, that causes that processor thread to do something, rather than the code running in the timer's thread.
Of course I can use thread syncronisation (Monitor
/using() {...}
) but wondered how it was done normally.