I create streams that join the server from multiple accounts. They work, everything is fine. But they, as it were, uncontrollable. If I want to send or do something in a particular stream, then it puts me in a stupor. I can not understand how to access the workflow, while sending him a method.

This is how I create threads:

public void thrd() { thread = new Thread[100]; for (int i = 0; i < Global.countthread; i++) { thread[i] = new Thread(this.Checking); thread[i].IsBackground = true; thread[i].Start(); } } 
  • 3
    Joseph Vissarionovich, and why not Task ? - VladD
  • What do you call the workflow? If this is a UI stream, you can send a method to it using SynchronizationContext.Send (synchronously) or SynchronizationContext.Post (asynchronously), and you need to have a link to the SynchronizationContext UI stream, which can be obtained, for example, in the form designer, or whatever you have . - Raider

0