Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2002-10-29 08:17:47


Yakov Bachmutsky said:
>
> ----- Original Message -----
> From: "Dirk Gerrits" <dirk_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Monday, October 28, 2002 7:32 PM
> Subject: [boost] Re: new libraries proposal
>
>
>> Yakov Bachmutsky wrote:
>>
>> > Hi,
>> >
>> > After a long break I'd like to take a little part in boost.
>>
>> [snip]
>>
>> > 3. A thread library that is related to the sync lib but can be
>> detached. Contains mainly a thread wrapper class that may be
>> inharited or used as is.
>> > Contains also thread factory class and such.
>>
>> There is already a thread library in Boost. Does your proposal offer
>> anything significantly different than that one?
>
> Mine is windows oriented.
> On a second thought, it would be better to add stuff to the existing
> one. What I have in addition to the existing is:
> 1. onException() called from ThreadProc (=threadproxy) to let the user
> decide what to do with it.

Hot topic, but I don't see how this adds much utility. Maybe I'm just not
fully understanding you. Care to elaborate?

> 2. since in windows threads are also sync objects, I can wait for a
> thread in my standard locks:
> lock _lock(my_thread, my_event)

Actually of limited utility, and very difficult to do portably. Not
likely to be added to Boost.Threads.

> 3. I use it to thread-run class member functions via a class inheriting
> CThread.

Actually a non-issue with Boost.Threads. I'm developing a large set of
tutorials that will include examples of how to accomplish this with
Boost.Threads, and to my mind the result is cleaner, more efficient, and
just as easy to code as the inheritance based approach. At it's simplest:

class MyThread
{
public:
   MyThread() : m_thread(boost::bind(&MyThread::run, this)) { }
   void run() { }
private:
   boost::thread m_thread;
};

I'd be very happy to discuss any of this though.

-- 
William E. Kempf

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