FreeBSD support for _POSIX_THREAD_PROCESS_SHARED is incomplete and buggy, avoid it.

This commit is contained in:
Ion Gaztañaga
2026-01-02 09:53:37 +01:00
parent 7764b3a747
commit e006a65aac
2 changed files with 8 additions and 4 deletions

View File

@@ -927,10 +927,6 @@ jobs:
then
echo "Executing: sudo pkg git bash python3 curl"
sudo pkg install -y git bash python3 curl
# Enable persistent umtx for vnode-backed shared memory synchronization
# This is needed for process-shared pthread mutexes in memory-mapped files
echo "Setting kern.ipc.umtx_vnode_persistent=1"
sudo sysctl kern.ipc.umtx_vnode_persistent=1
fi
if [ "${{matrix.vm}}" == "openbsd" ]
then

View File

@@ -65,6 +65,14 @@
//https://opensource.apple.com/source/libpthread/libpthread-301.30.1/src/pthread_cond.c.auto.html
//in method pthread_cond_wait
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
#elif defined(__FreeBSD__)
//The FreeBSD implementation is not workable for Interprocess as data structures
//hold raw pointers and even "kern.ipc.umtx_vnode_persistent" does not solve this issue
//because de vnode will be recycled anyway since it is only useful when:
// - Multiple processes have the file mapped **simultaneously**
// - The kernel needs to coordinate their wait queues
//See (https://man.freebsd.org/cgi/man.cgi?query=libthr) for details
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
#endif
//If buggy _POSIX_THREAD_PROCESS_SHARED is detected avoid using it