c# - Marshall to a thread manually -


In WinForms, you have Control.BeginInvoke () , which means that you call You can match the main thread thread for a background thread that has made the operation of control.

It's OK, but how (in C #) do you do this between two "standard" threads?

I wrote a service bus, which has a processor thread to consume messages. I want to put a timer in the fire, which gives the reason for doing something rather than the code running in the timer thread, to the processor thread.

Of course I use thread coordinates ( monitor / () {...} ), but it's amazing how this is done normally goes.

Unfortunately, it is difficult to answer here because it is highly dependent on the nature of the thread.

There is no built-in mechanism which makes it possible to do marshling magic among threads, for example in WinForms, Control.Invoke style work through the passage of message messages. A message has been posted on the UI thread, the message pump will eventually pump this message and convert it to Marshall's call.

To martial a call between a standard thread, there should be some capacity through which he can find a martial call and then want to make that call. It is usually done through some kind of message

IMHO is the most standard way of doing this, that your thread is to implement, provide and install a synchronization syntax. This is a more standard way of defining a marshalling mechanism between threads.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -