Boost logo

Boost :

Subject: Re: [boost] [interprocess] Just a note of thanks to the developers:)
From: Faisal Vali (faisalv_at_[hidden])
Date: 2008-09-06 12:57:48


"Ion Gaztañaga" <igaztanaga_at_[hidden]> wrote in message
news:48C1AACA.5090305_at_gmail.com...
> Faisal Vali wrote:
>>
>> Well, I was just wondering what was the reason for not including a
>> recursive_named_upgradeable_mutex?
>
> I just didn't see any use case for that. Is there any C++ synchronization
> library that offers this kind of mutex? Why do you need it?
>

I had created wrapper functions for my containers that were synchronized
using a named upgradeable mutex and lock guards, and ended up having to call
one function from the other (which causes deadlock if an exclusive lock is
got) - i thought a recursive lock would have allowed this (not sure the pros
and cons of this approach). But since there is no such mutex, i settled on
a couple of solutions: one involved creating a scoped_lock appropriately if
a bool param indicates a lock-recusrive call or not, the other uses
templatized versions that use an mpl::if_c to create noop locks if the
nontype bool param indicates to do so.

Please keep in mind that I am still learning about synchronization issues
(and am light on the theory, so i might have missed a common pattern for
solving this type of problem)
thanks,
-fas


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