I have a thread pool that is using shared mutexes from the boost library.
While the answers to my other question were helpful, http://stackoverflow.com/questions/3896717/example-of-how-to-use-boost-upgradeable-mutexes
What I have realised that what I actually need is not to block if a shared lock or upgrade lock could not be obtained. Unfortunately, the boost docs are lacking any examples of those in use.
Could someone please point me to or provide an example of specifically the shared_lock being used in this way.
i.e.
boost:shared_mutex mutex;
void thread()
{
// try to obtain a scoped shared lock
// How do I do that?
}
void thread2()
{
// try to obtain a scoped upgrade lock
// and then a scoped unique lock
}