Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2001-07-02 08:55:48


> > could you please explain why "thread types can't be extended
> > through inheritance" ?
>
> Because they're not objects. A Win32 handle can't be inherited
> from. A pthread_t descriptor can't portably be inherited from (on
> many platforms it's a pointer).

uhhfff.. i am not asking for inheritance from Win32
handles or pthread_t ids. they are not thread objects,
indeed. however, they _represent_ objects (internal thread
objects maintained by the implementation), and you could
certainly create _inheritable/extendable_ C++ thread _object_
which would hide pthread_t/handle or whatsoever so that only
that C++ thread object would know that platform specific "handle".
everybody else (user program) would simply use C++ ptr/refs
to C++ thread objects; and yes, you could certainly "extend"
these C++ ptrs/refs with ref-counting and either join/destroy
or detach policy. well, please re-check "timed_thread" C/POSIX
example i've posted a few days ago. it is not C++ but it does
implement thread object on top of posix thread id.

regards,
alexander.


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