Fix build on FreeBSD
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 10s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Failing after 11s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Has been cancelled
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 10s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Failing after 11s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 15s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Has been cancelled
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
@@ -399,6 +399,12 @@ dcfg_Version dcfg_get_version(void)
|
||||
| ((uint64_t)VERSION_PATCH & 0xFFFFFFFFULL);
|
||||
}
|
||||
|
||||
#if __FreeBSD__
|
||||
#define MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE
|
||||
#else
|
||||
#define MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#endif
|
||||
|
||||
dcfg_Instance *dcfg_make_instance(dcfg_InstanceCreateInfo const *create_info)
|
||||
{
|
||||
assert(create_info);
|
||||
@@ -410,7 +416,7 @@ dcfg_Instance *dcfg_make_instance(dcfg_InstanceCreateInfo const *create_info)
|
||||
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutexattr_settype(&attr, MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&instance->mtx, &attr);
|
||||
|
||||
instance->alloc = create_info->alloc;
|
||||
|
Reference in New Issue
Block a user