how to make a thread sleep forever
Is there an elegant way to make the current thread go to sleep forever? I simply want the current thread to sleep indefinitely, i.e. until a call to exit() or similar. Obviously I could call sleep() in a loop, or I could create an artificial deadlock, but I was wondering if there is a more elegant way? Cheers, Alex
On 5/6/2010 9:55 AM, Alex Flint wrote:
Is there an elegant way to make the current thread go to sleep forever? I simply want the current thread to sleep indefinitely, i.e. until a call to exit() or similar. Obviously I could call sleep() in a loop, or I could create an artificial deadlock, but I was wondering if there is a more elegant way?
Why can't you just exit the thread?
Hi!
what about locking a mutex and wait on this mutex from the thread. This is
also what you call artificial deadlock, but anyway. Another possiblity to
wait on an event which never occurs. E.g.
lock the mutex from the thread and use a condition variable which is never
signaled. I am just curios: why do you need such a thread at all?
Regards,
Ovanes
On Thu, May 6, 2010 at 4:55 PM, Alex Flint
Is there an elegant way to make the current thread go to sleep forever? I simply want the current thread to sleep indefinitely, i.e. until a call to exit() or similar. Obviously I could call sleep() in a loop, or I could create an artificial deadlock, but I was wondering if there is a more elegant way?
Cheers, Alex
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Alex Flint
-
Eric J. Holtman
-
Ovanes Markarian