Boost logo

Boost :

From: William E. Kempf (williamkempf_at_[hidden])
Date: 2002-08-06 10:38:35


----- Original Message -----
From: "Pete Becker" <petebecker_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, August 06, 2002 8:22 AM
Subject: RE: [boost] Re: Re: Threads & Exceptions

> At 08:48 AM 8/6/2002 -0400, Moore, Dave wrote:
> >I think the idea of parameterizing the return value has merit on the
> >"syntactic sugar" side of things, as the user doesn't have to create
their
> >own boost::function just so they can extract a return value - they can
still
> >pass simple function pointers.
>
> Function pointers are a C solution, not a C++ solution. Rather than
beefing
> up the C solution, I suggest a more object-oriented solution: a class with
> a member function that runs in a separate thread. These have been around
> for years, dating from long before the days of Java:
>
> class thread
> {
> public:
> thread();
> ~thread();
> void start();
> private:
> virtual void run() = 0;
> };
>
> Derived classes can hold whatever data they need. When the thread
finishes,
> the object's data can be examined to get the result. (Of course, thread
> would have more member functions than I'velisted, in order to be able to
> query the status of the thread)

This design too was considered and rejected. I think the function object
design in Boost.Threads is closer to modern C++ design philosophy then the
artificial inheritance based approach. If you don't agree I'd appreciate
hearing why?

Bill Kempf


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