mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-08-19 12:06:36 +00:00
use umtx_* locking functions on FreeBSD
This commit is contained in:
@@ -34,6 +34,25 @@ void uwsgi_unlock(void *lock) {
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef UWSGI_LOCK_USE_UMTX
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <sys/umtx.h>
|
||||
|
||||
void uwsgi_lock_init(void *lock) {
|
||||
umtx_init((struct umtx*) lock);
|
||||
}
|
||||
|
||||
void uwsgi_lock(void *lock) {
|
||||
umtx_lock(lock, 1);
|
||||
}
|
||||
|
||||
void uwsgi_unlock(void *lock) {
|
||||
umtx_unlock(lock, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -195,11 +195,15 @@ class uConf():
|
||||
if locking_mode == 'auto':
|
||||
if uwsgi_os == 'Linux':
|
||||
locking_mode = 'pthread_mutex'
|
||||
elif uwsgi_os == 'FreeBSD':
|
||||
locking_mode = 'umtx'
|
||||
elif uwsgi_os == 'Darwin':
|
||||
locking_mode = 'osx_spinlock'
|
||||
|
||||
if locking_mode == 'pthread_mutex':
|
||||
self.cflags.append('-DUWSGI_LOCK_USE_MUTEX')
|
||||
elif locking_mode == 'umtx':
|
||||
self.cflags.append('-DUWSGI_LOCK_USE_UMTX')
|
||||
elif locking_mode == 'osx_spinlock':
|
||||
self.cflags.append('-DUWSGI_LOCK_USE_OSX_SPINLOCK')
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user