Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-02-05 16:05:20


> On Wednesday, February 05, 2003 3:04 PM [GMT+1=CET],
> William E. Kempf <wekempf_at_[hidden]> wrote:
>
>> > What I would like to see is a new boost::thread implementation
>> which meets the following requirements.
>> >
>> > a. There shall be two interfaces to a thread. One for creation of a
>> thread, from
>> > here on called boost::thread. And, one for the created thread,
>> from
>> > here on called boost::thread::self.
>>
>> Self? Why? If it's on operation that can *only* be made on the
>> current thread, then a static method is a better approach. Otherwise,
>> I could make a "self" instance and pass it to another thread, which
>> could then attempt an operation that's not valid for calling on
>> another thread.
>
> It would seem to me that, given the availability of p->yield() as a
> syntax for invoking a static function, it'd be better to use a
> namespace-scope function to avoid errors and for clarity.

OK, I can buy that over a seperate self class. This was discussed at one
point, but the particular issue with p->yield() was never brought up. I'm
not sure I find it compelling, because which thread yields should be
evident from the documentation, and I don't see anyone ever using this
syntax. But compelling or not, I'm not opposed to making this a free
function if others think it's clearer in this regard.

-- 
William E. Kempf
wekempf_at_[hidden]

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