« Return to Thread: [thread] is this reverse_lock class a source of errors?

Re: [thread] is this reverse_lock class a source of errors?

by Anthony Williams-3 :: Rate this Message:

Reply to Author | View in Thread

"vicente.botet" <vicente.botet@...> writes:

> Hi,
>
> Consider the following situations:
>
>  {
>      unique_lock<mutex> lock(smtx);
>
>      // ... some writing operations
>
>      { // non locked block
>          reverse_lock< unique_lock<mutex> > rlock(lock);
>          // ... some code not needing the mutex to be locked
>      } // locked again
>
>      // ...
> }

> Do you think this usage is souhaitable or is this source of errors?

I've had to do it myself a few times. I think it's worthwhile adding it to the
library in order to ensure it is done as safely as possible.

Anthony
--
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

 « Return to Thread: [thread] is this reverse_lock class a source of errors?