Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-12-14 09:20:01


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_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]]Im Auftrag von
> boost-users-request_at_[hidden]
> Gesendet: Donnerstag, 14. Dezember 2006 14:55
> An: boost-users_at_[hidden]
> Betreff: Boost-users Digest, Vol 1117, Issue 1
>
>
> Send Boost-users mailing list submissions to
> boost-users_at_[hidden]
>
> 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_at_[hidden]
>
> You can reach the person managing the list at
> boost-users-owner_at_[hidden]
>
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net