use umtx_* locking functions on FreeBSD

This commit is contained in:
roberto@freebsd64
2010-12-17 13:44:33 +01:00
parent 860a017060
commit 3104f915e5
2 changed files with 23 additions and 0 deletions
+19
View File
@@ -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
+4
View File
@@ -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: