You can use lock/unlock methods no? -----Mensaje original----- De: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org]En nombre de Ovanes Markarian Enviado el: jueves, 14 de diciembre de 2006 15:20 Para: boost-users@lists.boost.org Asunto: Re: [Boost-users] threads / scoped_lock Hi! you could define a scope where to lock ;) Just like this: boost::mutex a_mutex; ... { { boost::mutex::scoped_lock lock(a_mutex); //lock cout<<"bla"; }//end of scope => unlock //much of code where cout dont has to be locked ... } With Kind Regards, Ovanes Markarian On Thu, December 14, 2006 15:12, Goroll, Torsten wrote:
Hi,
as I understand the scoped_lock, it locks every ressource in a code block. What if I dont want to lock a ressource all the time the method is running? Do I have to create a new method?
Example:
boost::mutex a_mutex; ... { boost::mutex::scoped_lock lock(a_mutex); cou<<"bla";
//much of code where cout dont has to be locked ... }
Torsten
-----Ursprüngliche Nachricht----- Von: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org]Im Auftrag von boost-users-request@lists.boost.org Gesendet: Donnerstag, 14. Dezember 2006 14:55 An: boost-users@lists.boost.org Betreff: Boost-users Digest, Vol 1117, Issue 1
Send Boost-users mailing list submissions to boost-users@lists.boost.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.boost.org/mailman/listinfo.cgi/boost-users or, via email, send a message with subject or body 'help' to boost-users-request@lists.boost.org
You can reach the person managing the list at boost-users-owner@lists.boost.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Boost-users digest..." _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users