Skip to content

Commit e006a65

Browse files
committed
FreeBSD support for _POSIX_THREAD_PROCESS_SHARED is incomplete and buggy, avoid it.
1 parent 7764b3a commit e006a65

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,10 +927,6 @@ jobs:
927927
then
928928
echo "Executing: sudo pkg git bash python3 curl"
929929
sudo pkg install -y git bash python3 curl
930-
# Enable persistent umtx for vnode-backed shared memory synchronization
931-
# This is needed for process-shared pthread mutexes in memory-mapped files
932-
echo "Setting kern.ipc.umtx_vnode_persistent=1"
933-
sudo sysctl kern.ipc.umtx_vnode_persistent=1
934930
fi
935931
if [ "${{matrix.vm}}" == "openbsd" ]
936932
then

include/boost/interprocess/detail/workaround.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
//https://opensource.apple.com/source/libpthread/libpthread-301.30.1/src/pthread_cond.c.auto.html
6666
//in method pthread_cond_wait
6767
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
68+
#elif defined(__FreeBSD__)
69+
//The FreeBSD implementation is not workable for Interprocess as data structures
70+
//hold raw pointers and even "kern.ipc.umtx_vnode_persistent" does not solve this issue
71+
//because de vnode will be recycled anyway since it is only useful when:
72+
// - Multiple processes have the file mapped **simultaneously**
73+
// - The kernel needs to coordinate their wait queues
74+
//See (https://man.freebsd.org/cgi/man.cgi?query=libthr) for details
75+
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
6876
#endif
6977

7078
//If buggy _POSIX_THREAD_PROCESS_SHARED is detected avoid using it

0 commit comments

Comments
 (0)