Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2001-08-18 13:23:03


> There is another possibility: 'thread::~thread' blocks until the thread
has
> actually terminated. This means that for every thread, there always
exists
> a thread object (but not necessarily vice versa). I'm not sure how
useful
> this would be in practice.

this is what pthread_join does (though i think that
awaiting should be done in pre-destructor, in order
to support inheritance). another alternative is to
dynamically create your threads detached (dynamic
C++ thread objects) or detach them after creation..
asking for automatic destruction (C++ *and* native
thread objects) on thread termination (or immediate
destruction if target thread already terminated).
another alternative could be to dynamically create
ref.counted threads (objects) and detach them
(or even join to e.g. reclaim application provided
stack; but then not counting "self" ref.) automatically
(if not already joined; if joined simply destroy
C++ thread object).

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk