By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,260 Members | 1,344 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,260 IT Pros & Developers. It's quick & easy.

Send a message to a thread

P: n/a
Hi

Is there any method to send a message to a running thread so the thread will
perform a specific function before the program suspends it?

Thank you,
Shmuel Shulman
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Shmuel,

Yes. But, the thread must be implemented specifically for that type of
behavior. To create your own thread that does this you need to have it
run an infinite loop that waits for an object to appear in a queue.
When an object appears the thread wakes up and processes that object
accordingly. Other threads have access to the queue so that they can
enqueue objects at any time.

UI threads behave this way because they run a windows message pump.
Other threads can instruct the UI thread to run some function by using
Control.Invoke. Invoke takes a delegate as a parameter and posts a
message to the UI thread's message queue instructing it to execute the
specified delegate.

Brian

S Shulman wrote:
Hi

Is there any method to send a message to a running thread so the
thread will perform a specific function before the program
suspends it?

Thank you,
Shmuel Shulman


Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.