Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2006-09-20 07:16:24


Anthony Williams wrote:
[...]
> bias. We could just do a spin-wait if we want really-fast locks and unlocks
> --- except that for long-lasting locks, a waiting thread would consume CPU
> time spinning, and hence hinder the progress of other threads.

Right. So we need to block/unblock. But there's no need for ownership
handoff. So let unblocked thread compete just like in the case of a
spinlock. Or rather think of block/unblock logic in efficient lock as
just a spinlock with "usleep(magic());" resulting in exact right time
to sleep until the lock is released by the owner. Okay? ;-)

regards,
alexander.


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