Boost logo

Boost :

Subject: [boost] [interprocess]
From: Joseph Van Riper (fleeb.fantastique_at_[hidden])
Date: 2012-07-09 11:51:50


I am either having some problems with the documentation, or I've stumbled
into a bug in Boost.Interprocess's named_condition.

I'm compiling on VC++ 2010, 32 or 64 bit, with the following test code:

#include "stdafx.h"
#include <boost/interprocess/sync/named_condition.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>

int _tmain(int argc, _TCHAR* argv[])
{
boost::interprocess::named_mutex mutex(
boost::interprocess::open_or_create, "test" );
boost::interprocess::named_condition condition(
boost::interprocess::open_or_create, "test" );
condition.wait( mutex );
return 0;
}

I get the following compiler errors:

1>------ Build started: Project: TestInterprocess, Configuration: Debug
Win32 ------
1>Build started 09-Jul-12 11:45:22 AM.
1>InitializeBuildStatus:
1> Touching "Debug\TestInterprocess.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> TestInterprocess.cpp
1>c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(204):
error C2248: 'boost::interprocess::interprocess_mutex::mutex' : cannot
access private member declared in class
'boost::interprocess::interprocess_mutex'
1>
 c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\interprocess_mutex.hpp(117)
: see declaration of 'boost::interprocess::interprocess_mutex::mutex'
1>
 c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\interprocess_mutex.hpp(67)
: see declaration of 'boost::interprocess::interprocess_mutex'
1>
 c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(204)
: while compiling class template member function
'boost::interprocess::ipcdetail::shm_named_condition::lock_wrapper<Lock>::mutex_type
*boost::interprocess::ipcdetail::shm_named_condition::lock_wrapper<Lock>::mutex(void)
const'
1> with
1> [
1> Lock=boost::interprocess::named_mutex
1> ]
1>
 c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(342)
: see reference to class template instantiation
'boost::interprocess::ipcdetail::shm_named_condition::lock_wrapper<Lock>'
being compiled
1> with
1> [
1> Lock=boost::interprocess::named_mutex
1> ]
1>
 c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\named_condition.hpp(156)
: see reference to function template instantiation 'void
boost::interprocess::ipcdetail::shm_named_condition::wait<L>(L &)' being
compiled
1> with
1> [
1> L=boost::interprocess::named_mutex
1> ]
1>
 c:\code\projects\testinterprocess\testinterprocess\testinterprocess.cpp(10)
: see reference to function template instantiation 'void
boost::interprocess::named_condition::wait<boost::interprocess::named_mutex>(L
&)' being compiled
1> with
1> [
1> L=boost::interprocess::named_mutex
1> ]
1>c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(204):
error C2064: term does not evaluate to a function taking 0 arguments
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:05.97
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am lead to believe that I should used a named_mutex by the documentation
here:

http://www.boost.org/doc/libs/1_50_0/doc/html/boost/interprocess/named_condition.html

which states in the description that "This condition variable is designed
to work with named_mutex and can't be placed in shared memory


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk