Boost logo

Boost :

From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2005-06-09 12:07:07

On Thu, 9 Jun 2005 12:56:55 -0400
Jody Hagins <jody-boost-011304_at_[hidden]> wrote:

Oops. I forgot to add this...

Notice one obvious issue: notify_one() and notify_all() still go through
the native CV code to ping potential waiting threads. However, without
significant change to the current implementation of condition, I do not
see an easy way to prevent this.

Initially, I added condition_t<>, and specialized condition_t<void> to
be identical to the current implementation of condition,
condition_t<null_mutex> has no-ops for notify_*(), and the default
implementation of condition_t<typename Lock> is identical to
condition_t<void>, except the member functions are not templatized on
the lock type (since the class is already templatized that way).

Then, we also have...

typedef condition_t<void> condition;

which should leave all existing use of condition, working the same.

However, this is a lot of change, for an optimization (calling
notify_*() should not break anything), and I wanted to present as small
of a change as possible. If this is accepted, then it may be worth
adding the optimization, and then writing tests to make sure it does not
break anything that uses condition in its current state...

Boost list run by bdawes at, gregod at, cpdaniel at, john at