Boost logo

Boost :

From: duncan_at_[hidden]
Date: 2001-06-27 08:58:07


pdimov_at_[hidden] (Peter Dimov) wrote:

> FWIW, I actually like procedural interfaces, when they fit. There is
> nothing inherently low-level about them. thread::id may implement the
> handle/refcounted body idiom under the hood, or it may be a Win32
> HANDLE. In a way, this interface is higher level, because it hides
> more of the implementation.
>
> The important difference between thread::id and FILE* is that a FILE*
> may leak. A thread::id can never leak. It has proper value semantics,
> so the 'thread reference' it contains will be released upon its
> destruction; and the thread will terminate itself when it's done.

Surely if the id is just a Win32 HANDLE then you have a leakage problem?
Something has to close the handle to avoid a leak. If it were a Win32
thread id that is not good enough because something must maintain an
open handle to guarantee the thread id's uniqueness. So you are back to
ref-counted handle-body and presumably the ref count must be thread
safe.

--
Duncan Harris, Sapio Design Ltd, Manchester, U.K.

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