L
Lars Uffmann
Hi everyone,
Simple question: Is there a lock object in boost::thread that I can
associate with a boost::mutex upon creation, but which doesn't try to
acquire a lock until I explicitely tell it to?
Namely, I wish to acquire a lock and release it multiple times in a
function, but always on the same mutex - somehow it seems not sensible
to always create a new lock and delete it afterwards.
And with different code paths for the first usage, I cannot just create
it upon first need for a lock and then unlock / lock it later.
Any idea? Wasn't able to find anything in the boost::thread docs at
http://www.boost.org/doc/html/thread/concepts.html#thread.concepts.lock-concepts
All the locks there say for the constructor:
Constructs an object lk, and associates mutex object m with it, then
calls lock()
Thanks in advance!
Lars
PS: Please refrain from replies about being off-topic, usage of boost is
very on-topic in my eyes and there is no boost newsgroup, just a
mailinglist with a news-like (read only) portal
Simple question: Is there a lock object in boost::thread that I can
associate with a boost::mutex upon creation, but which doesn't try to
acquire a lock until I explicitely tell it to?
Namely, I wish to acquire a lock and release it multiple times in a
function, but always on the same mutex - somehow it seems not sensible
to always create a new lock and delete it afterwards.
And with different code paths for the first usage, I cannot just create
it upon first need for a lock and then unlock / lock it later.
Any idea? Wasn't able to find anything in the boost::thread docs at
http://www.boost.org/doc/html/thread/concepts.html#thread.concepts.lock-concepts
All the locks there say for the constructor:
Constructs an object lk, and associates mutex object m with it, then
calls lock()
Thanks in advance!
Lars
PS: Please refrain from replies about being off-topic, usage of boost is
very on-topic in my eyes and there is no boost newsgroup, just a
mailinglist with a news-like (read only) portal