Boost logo

Boost Users :

From: Andrew Agno (andrewagno_at_[hidden])
Date: 2007-03-07 18:33:00


I'm trying to run the following program, which works under Linux, on an
intel
mac:

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

using namespace std;
namespace bi = boost::interprocess;

int main( int argc, char **argv )
{
   cout << "Creating mutex" << endl;
try
{
   bi::named_mutex directoryMutex( bi::create_only,
"MyVeryUniquelyNamedMutex" );
   cout << "Creating scoped lock" << endl;
   bi::scoped_lock<bi::named_mutex> lock( directoryMutex );
   cout << "All reqs met. Destroying mutex" << endl;
   bi::named_mutex::remove( "MyVeryUniquelyNamedMutex" );
}
catch( std::exception &e )
{
   cout << "Problem encountered: " << e.what() << endl;
}

   return 0;
}

I'm using a combination of the boost CVS for the interprocess header
files and
everything else from 1.33.1. The interprocess headers are current as of
Mar 7.
I've also tried open_or_create, and get the same result.

On linux, this seems to work fine, with output:
$ ./test
Creating mutex
Unlocking mutex
Creating scoped lock
All reqs met. Destroying mutex
$

On the mac, it outputs:
$ ./test
Creating mutex
Problem encountered:
$

$ uname -a
[...] 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006;
root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
$ g++ -dumpversion
4.0.1
$ g++ -dumpmachine
i686-apple-darwin8


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