Opened 8 years ago

Last modified 4 years ago

#11154 new Bugs

Constructing boost::interprocess::interprocess_semaphore throws in MacOS 10.9.5

Reported by: Jonathan Jones <jonathan.jones@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.56.0 Severity: Regression
Keywords: Cc: dave.lowell@…

Description

Using boost::interprocess::interprocess_semaphore from Boost 1.56 and running MacOS 10.9.5, it simply throws an exception saying the function is not implemented:

libc++abi.dylib: terminating with uncaught exception of type boost::interprocess::interprocess_exception: Function not implemented

This is a regression from Boost 1.49 and MacOS 10.9.5, where this works fine.

Looking at the two, it appears that 1.49 is using the generic spin emulation for interprocess_semaphore, whereas 1.56 is implementing interprocess_semaphore using POSIX unnamed semaphores, which aren't implemented in MacOS 10.9.5.

Attachments (1)

interprocess_semaphore.cpp (134 bytes ) - added by Jonathan Jones <jonathan.jones@…> 8 years ago.
Reproduction program

Download all attachments as: .zip

Change History (6)

by Jonathan Jones <jonathan.jones@…>, 8 years ago

Attachment: interprocess_semaphore.cpp added

Reproduction program

comment:1 by Ion Gaztañaga, 8 years ago

Thanks for the report. It seems that Mac Os incorrectly reports POSIX semaphores as supported, this was fixed in master and develop branches, can you try Boost 1.58 Beta to confirm this was fixed for you?

comment:2 by Jonathan Jones <jonathan.jones@…>, 8 years ago

Thanks for responding so quickly!

Would it be possible for you to attach a patch to this bug report that we can apply to 1.56.0?

comment:3 by dave.lowell@…, 8 years ago

Cc: dave.lowell@… added

comment:4 by Ion Gaztañaga, 8 years ago

There were too many changes for a clean patch. For a workaround change:

boost/interprocess/sync/interprocess_semaphore.hpp

and change the preprocessor code to avoid entering in the following configuration

#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \
   (defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES))
   #include <boost/interprocess/sync/posix/semaphore.hpp>
   #define BOOST_INTERPROCESS_USE_POSIX

It should use configuration:

#elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
   #include <boost/interprocess/sync/spin/semaphore.hpp>
   #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION
#endif

comment:5 by jonathan.jones@…, 4 years ago

Confirmed (finally) that this was fixed in Boost 1.65.1. May have been fixed in earlier releases, since we jumped from 1.56.0 directly to 1.65.1.

Note: See TracTickets for help on using tickets.