Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-06-27 10:56:56


--- In boost_at_y..., Beman Dawes <bdawes_at_a...> wrote:
> At 10:03 AM 6/27/2001, williamkempf_at_h... wrote:

> >Another thing I've thought of over night. This design makes it
> >impossible to have a self() method, but I think this
functionality is
> >a necessity.
>
> Yes, you said that before, but I still don't understand why you
don't just
> pass a thread ref or pointer to the initial thread function as an
> argument. Why isn't that satisfactory?

class thread_group
{
public:
   void push(thread* thrd);
   void wait_all() {
      // pseudo code
      for each managed thread
      {
         if (managed thread == self)
           throw;
      }
   }
};

Being passed a reference to the thread in the thread's start routine
is not enough for this simple example. It's contrived, but it's
enough to illustrate the problem to good effect, I believe.

Adding an is_current() to thread would take care of this case, but as
we add to the operations that can be performed on a thread, such as
setting its priority, the need for self() becomes greater. I
honestly don't think we can do with out this operation.

Bill Kempf


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