Boost logo

Boost :

From: Matt Hurd (matt.hurd_at_[hidden])
Date: 2005-05-02 01:42:12


> Michael Glassford wrote:
> > Matt Hurd wrote:

<snip>

> > It still not clear to me how the lock transfers operate under
> > simultaneous requests.
>
> "Transfer" from a mutex is really just a delayed call to a lock method,
> so I don't see a problem: if there are simultaneous requests, one blocks
> and the other doesn't.
>
> Transfer from a lock shouldn't happen simultaneously (locks, by design,
> are not thread-safe), so that shouldn't be a problem either.

I was thinking of the initialisation of the lockd from the mutex by
transfer, but I fail to see any problem today.

I do like the simplicity of the concept in that the destructor just
calls the bound method to unlock. However, do you think the overhead
of such an approach for all locks would be worthwhile? I'm not sure
current compilers will be able to inline and agressively optimise such
an approach as well as the current approach. It will have to be
benchmarked carefully I guess.

Regards,

Matt.


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