On 15 July 2014 16:42, Ladislav Sopko wrote:
Hello,
I did try to continue with */Ion Gaztanaga's /*idea of portable robust mutex. I post my code and considerations in codereview.
http://codereview.stackexchange.com/questions/57083/portable-c-boostiterproc...
I hope to find some one to discuss about.
I'll have to take a good look at that code. In my attempt to implement a robust mutex that models the C++11 Mutex concept I decided to add a new overload of try_lock, taking a tag type to indicate you are prepared to deal with the inconsistent state. The C++11 try_lock() function only returns true or false, which can't support the third state that can occur when locking a robust mutex, and I didn't want to rely on users calling an extra function to query whether a successful try_lock was *really* successful (in generic code working with any Mutex type failing to handle the inconsistent state could be disastrous). If you call the normal zero-argument try_lock() on my type and it's inconsistent you get an exception and it's marked as unrecoverable. If you call the try_lock(robust_t) overload you get a chance to recover it. https://gitorious.org/redistd/redistd/source/0d9c849726729e66e5703fadba0222d...