Reputation: 835
"The wait() system call suspends execution of the current process until one of its children terminates" . Waitpid also is similar.
My Question is whether calling wait() from one thread will cause all other threads (in the same process) also to go to sleep ? Do the behavior is same for detached threads also?
Upvotes: 0
Views: 453
Reputation: 327
Should only stop the current thread. If you want to make people ill when they look at your code and cause yourself a lot of problems you can use this for jury rigged thread synchronization. I wouldn't reccommend it though.
Upvotes: 0
Reputation: 215287
This is just a bug in the manual. wait
suspends the calling thread, not the process. There is absolutely no way to suspend the whole process short of sending it SIGSTOP
or manually suspending each thread one at a time.
Upvotes: 4
Reputation: 1516
As far as I know, calling wait from any thread will cause all threads which are associated with that process to halt.
But don't hold me to that. Best thing to do would be to test it.
Upvotes: 0