Boost logo

Boost :

Subject: [boost] [interprocess] named_condition compile failure...
From: Joseph Van Riper (fleeb.fantastique_at_[hidden])
Date: 2012-07-09 11:58:57


I have either not understood the documentation, or found a bug in
Boost.Interprocess's named_condition class. If I'm in error, I hope
someone can help me. Otherwise, I will need to approach my needs another
way.

I assume that named_condition requires a named_mutex, as the documentation
states in the Description here:

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

"This condition variable is designed to work with
named_mutex<http://www.boost.org/doc/libs/1_50_0/doc/html/boost/interprocess/named_mutex.html>
and
can't be placed in shared memory or memory mapped files."

Unfortunately, at least on a VC++ 2010 compiler, this doesn't seem to
compile for me.

I am using 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;
}

With this code, I get the following error:

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

- Trey


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