Opened 5 years ago

Last modified 22 months ago

#7682 reopened Bugs

boost 1.52 named_mutex/named_condition pairing broken

Reported by: damian.coventry@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.52.0 Severity: Showstopper
Keywords: Cc:


The following program works in boost 1.47, however in 1.52 it does not. To test it, run 2 instances. The 2nd instance should output the numbers 1, 3, 5, 7, 9.

Under 1.52, the program outputs the number 1, and then does nothing. The fault appears to be with the named_condition and named_mutex classes.

Tested under Windows 7 Pro, SP1, using Visual Studio 2010 v10.0.40219.1 SP1Rel. The test was done with a statically linked boost date time, with Platform Toolset set to v90, i.e. linked with the library 'libboost_date_time-vc90-mt-sgd-1_47.lib'.

#include <boost/interprocess/managed_shared_memory.hpp> 
#include <boost/interprocess/sync/named_mutex.hpp> 
#include <boost/interprocess/sync/named_condition.hpp> 
#include <boost/interprocess/sync/scoped_lock.hpp> 
#include <iostream> 

int main() 
  boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_or_create, "shm", 1024); 
  int *i = managed_shm.find_or_construct<int>("Integer")(0); 
  boost::interprocess::named_mutex named_mtx(boost::interprocess::open_or_create, "mtx"); 
  boost::interprocess::named_condition named_cnd(boost::interprocess::open_or_create, "cnd"); 
  boost::interprocess::scoped_lock<boost::interprocess::named_mutex> lock(named_mtx); 
  while (*i < 10) 
    if (*i % 2 == 0) 
      std::cout << *i << std::endl; 

Attachments (0)

Change History (8)

comment:1 Changed 5 years ago by jeff.trull@…

I can confirm this behavior on 1.52 and also in trunk, for gcc 4.7.2.

comment:2 Changed 5 years ago by jeff.trull@…

Breaking rev is 80146 "[named_/interprocess]sharable_mutex & [named_/interprocess]condition_any implemented"

comment:3 Changed 5 years ago by Ion Gaztañaga

Thanks for the report. It was also reported in #8008.

comment:4 Changed 5 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

(In [82796]) Fixes #7682

comment:5 Changed 5 years ago by Jeff Trull <edaskel@…>

I can confirm this works in trunk now

comment:6 Changed 23 months ago by ravi.bhoite@…

It doesn't work on 1.55.0. I have verified it on Boost 1.55.0.

comment:7 Changed 23 months ago by anonymous

Resolution: fixed
Status: closedreopened

reopening the issue

comment:8 Changed 22 months ago by Ion Gaztañaga

Can you please elaborate what is not working? Current version seems to works perfectly. Boost 1.55 is two years old, can you please check that currect version (1.60.0) works as expected for you?

Modify Ticket

Change Properties
Set your email in Preferences
as reopened The owner will remain Ion Gaztañaga.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.