Boost logo

Boost Users :

Subject: Re: [Boost-users] How to use scoped_lock
From: Kim Barrett (kab.conundrums_at_[hidden])
Date: 2010-03-20 01:49:00


On Mar 20, 2010, at 1:16 AM, weii wrote:
> I got a compiler(gcc 3.4.5) error while using boost.thread.
>
> The following is my code:
> -----------------------------------------------------------------------------------------------------------------------------
> #include <boost/thread/thread.hpp>
> #include <boost/thread/mutex.hpp>
> #include <boost/bind.hpp>
> #include <iostream>
>
> boost::mutex io_mutex;
>
> void count(int id)
> {
> boost::mutex::scoped_lock lock(io_mutex,false);

The problem is the second argument in the lock construct. The old mechanism of constructing an unlocked lock went away in (I think) boost 1.35. I don't remember how it gets there, but the I do remember (from cleaning up a bunch of explicit and unnecessary true second arguments in some code I inherited) that the failure was reporting something about timed_mutex.


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