Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-12-09 16:43:23


Yuval Ronen wrote:
> I believe that we are going a bit off the topic here, but I'll go
> there with you.
>
> What you are suggesting, is that what we now know as 'thread' will be
> transformed into 'thread_impl' and will be hidden from the user,
> which will only know about thread_ref (actually a
> shared_ptr<thread_impl>). First of all, in no way do I dismiss this
> proposal. But what is the difference between this and the current
> design?

The difference is:

Current design:

(thread data, including function object)
(thread class, noncopyable)

thread_ref design:

(thread data)

The current design has two logical object per thread, one that remains alive
until the thread finishes execution, another that is created by the user and
can be destroyed at any time.

> Another thing: if we want a
> thread_ref current_thread();
> function, how will it be implmented?

A thread_ref is held in thread-specific storage (keeping the thread object
alive for the lifetime of the thread as a side effect) and is returned by
current_thread().


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