Hello Michael,

*this is a pointer to the mutex that the 'lock_guard' is using. The name "this" is unfortunate since it overlaps with an object's 'this' pointer... unless your class 'mytype' is derived from a mutex....


I've usually seen it used on just a boost::mutex.
boost::mutex    the_lock;

and later in some code associated with the lock, you could activate it in a block by doing;
boost::lock_guard<boost::mutex>    lock(the_lock);
...do stuff....

Consider looking at: http://www.boost.org/doc/libs/1_53_0/doc/html/thread/synchronization.html#thread.synchronization.tutorial and searching for lock_guard I think it has a pretty decent example there.


On 4/1/2013 4:12 PM, Michael Powell wrote:
Hello,

The pattern goes something like this: boost::lock_guard<mytype> guard(*this).

However, compiler is asking for a lock or unlock. I don't know what this is, or what it should be.

Thank you...

Regards,

Michael Powell


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users