mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
This commit addresses the test failures reported in issue #156 on FreeBSD platform. 1. Fix POSIX semaphore naming for FreeBSD compatibility - FreeBSD requires semaphore names to start with "/" - Add "_sem" suffix to avoid namespace conflicts with shm - Store semaphore name separately for proper cleanup - This fixes all 24 semaphore test failures 2. Fix robust mutex EOWNERDEAD handling - When pthread_mutex_lock returns EOWNERDEAD, the lock is already acquired by the calling thread - After calling pthread_mutex_consistent(), we should return success immediately, not unlock and retry - Previous behavior caused issues with FreeBSD's libthr robust mutex list management, leading to fatal errors - This fixes the random crashes in MutexTest Technical details: - EOWNERDEAD indicates the previous lock owner died while holding the lock, but the current thread has successfully acquired it - pthread_mutex_consistent() restores the mutex to a consistent state - The Linux implementation worked differently, but the new approach is more correct according to POSIX semantics and works on both Linux and FreeBSD Fixes #156 |
||
|---|---|---|
| .. | ||
| condition.h | ||
| get_wait_time.h | ||
| mutex.h | ||
| semaphore_impl.h | ||
| shm_posix.cpp | ||