Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] boost::thread automatically detached when thread terminates?
From: Ray Burkholder (ray_at_[hidden])
Date: 2010-09-12 09:12:35


> >> Thanks for your reply! Do you know whether the thread of execution is
> >> allowed to call boost::thread::detach()? Then it could detach itself
> >> from the boost::thread object before it terminates and
> >> boost::thread::joinable() should work? I'm not sure though if
> >> boost::thread is thread-safe?
>
> I want a worker thread to terminate if there is nothing to do. If there
> is
> something to do again and the worker thread has terminated I need to
> create a new one. Now I wonder if I can use boost::thread to detect
> whether the thread is running or not.
>

How about using boost::asio. It automatically deals with worker threads and
such.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net