Hey,
Is there an easy way to create a thread in a suspended/paused state and the resume it later..?
I mean I could use a lock/sems... But is there a "nicer" way?
Cheers.
Printable View
Hey,
Is there an easy way to create a thread in a suspended/paused state and the resume it later..?
I mean I could use a lock/sems... But is there a "nicer" way?
Cheers.
There is no suspend/resume interface. You have to use blocking primitives.
gg
Yeah thats what I thought... Done that and it seems to work... Thanks for your help.
Quick one... Pthreads & signals - what happens if I send SIGSTOP to a thread using pthread_kill()? Will it halt the whole process or just that thread???
Also is there a pthread equivalent of waitpid()? I.e. can I setup to wait until a thread Rxes a signal (say sigstop) and is in a halt state etc..?
Cheers,
NW
>> Will it halt the whole process or just that thread?
Still affects the process. pthread_kill just lets you control which thread will handle the signal.
>> pthread equivalent of waitpid()?
You can call pthread_join (on an attached thread) to wait for a thread to exit.
>> I setup to wait until a thread Rxes a signal (say sigstop) and is in a halt state etc..?
Well, you could certainly use signals to communicate with your threads.
Here's the 2004 Posix specification: http://www.opengroup.org/onlinepubs/009695399/toc.htm
The pthread_sigmask page has example code for signal polling in a thread.
Here's what Posix has to say on "signal concepts": http://www.opengroup.org/onlinepubs/...chap02_04.html
For completeness, here's the 2008 Posix spec: http://www.opengroup.org/onlinepubs/9699919799/toc.htm
gg