Could some one please give me an example of how to explitly lock and unlock mutexs using the boost libarys because i cant seem to make it work.
Thanks
Printable View
Could some one please give me an example of how to explitly lock and unlock mutexs using the boost libarys because i cant seem to make it work.
Thanks
What did you try and what was the error?
gg
It depends on your Boost version, but you could try something like this.
If you are using older Boost versions that don't have the lock/unlock functions there are some hacks that may help.
Code:boost::mutex mymutex;
void myprotectecfunction() {
boost::mutex::scoped_lock mylock(mymutex, boost::defer_lock); // defer_lock makes it initially unlocked
mylock.lock();
mylock.unlock();
}