|
Threads-Devel : |
Subject: Re: [Threads-devel] Compile error w/ 1.36
From: Anthony Williams (anthony_at_[hidden])
Date: 2008-09-04 10:12:10
At Thu 04 Sep 2008 14:53:40 BST, Chris Newbold
<Chris.Newbold_at_[hidden]> wrote:
> I'm in the process of evaluating Boost 1.36 as a potential upgrade
> from 1.35, in part to get the critical fixes to Boost.Thread.
>
> I've found, however, that something appears to have been broken with
> the library-level header and the way that it includes all the
> more-specific headers. My cursory search of the mailing list didn't
> reveal any previous reports; my apologies if I missed something.
>
> Here's my one-line test program:
>
> #include <boost/thread.hpp>
>
> This compiles cleanly using 1.35, but with 1.36 there are a number
> of errors related to condition_variable::wait and shared_mutex:
<boost/thread/shared_mutex.hpp> is not included by <boost/thread.hpp>
in 1.35, but it is in 1.36. I suspect you'll get similar problems with
1.35 if you include that header directly. If that's the case, the
workaround is either to patch boost/thread.hpp, or include just the
individual headers you need.
However, I'd really like to be able to fix the problem. What platform
are you on? From the error messages, I'm guessing some variety of
linux/unix.
The error happens in the following code:
boost::mutex::scoped_lock lock(state_change);
while(state.exclusive || state.exclusive_waiting_blocked)
{
shared_cond.wait(lock); // error on this line
}
and it looks like the compiler things lock is a function type rather
than an object type. This may be a name lookup issue: Boost 1.36 has
new lock functions in the <boost/thread/locks.hpp> header for locking
more than one mutex.
Can you try renaming the scoped_lock object to "lk" or something (and
updating the condition variable wait call), and see if that works? Of
course, you'll have to fix all the instances it's complaining about.
Anthony
-- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL