I have two non UI Threads.
- Thread A
- Thread B
Thread A raise an event and Thread B listen to this event. When the Thread B Event Listener is executed, it got executed on Thread A (I think, because Thread A raises the event).
What I'd like to do is, be able to raise an event on Thread A and if Thread B is listening, the Listener should get executed on Thread B.
Something like this:
private void SomeMethodOnThreadA()
{
synchronizationContextOfThreadB.Send(new SendOrPostCallback(o =>
{
EventXy(this, new EventArgs());
}), null);
}
But this is not working since I’m my threads are non UI threads.