cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
Waiting for Detached Thread
Waiting for Detached Thread
Dec 22, 2013 at 6:45pm UTC
mqazi
(31)
How can I make main() thread to wait for a detached thread without using sleep ? Is main thread is kernel level thread ?
Last edited on
Dec 22, 2013 at 7:23pm UTC
Dec 22, 2013 at 9:20pm UTC
Cubbi
(4774)
Waiting for a detached thread defeats the point: threads are detached if there's no reason to join them.
As a workaround, the main thread could wait on a condition variable that is notified by the detached thread at exit.
Jan 3, 2014 at 1:17pm UTC
mqazi
(31)
thanks Cubbi
Jan 3, 2014 at 2:26pm UTC
kbw
(9488)
... or you could not detatch the thread in the first place.
Topic archived. No new replies allowed.