"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/lsr/ls_lock.h" between
openlitespeed-1.5.6.src.tgz and openlitespeed-1.6.0.src.tgz

About: OpenLiteSpeed is a high-performance, lightweight HTTP server with optional HTTP/2 support (open sourve version of the commercial LiteSpeed Web Server). Sources.

ls_lock.h  (openlitespeed-1.5.6.src.tgz):ls_lock.h  (openlitespeed-1.6.0.src.tgz)
skipping to change at line 79 skipping to change at line 79
/* LiteSpeed general purpose lock/unlock/trylock /* LiteSpeed general purpose lock/unlock/trylock
*/ */
#ifdef USE_F_MUTEX #ifdef USE_F_MUTEX
typedef int32_t ls_mutex_t; typedef int32_t ls_mutex_t;
#else #else
typedef pthread_mutex_t ls_mutex_t; typedef pthread_mutex_t ls_mutex_t;
#endif #endif
#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) #if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#include <libkern/OSAtomic.h> #include <os/lock.h>
typedef OSSpinLock ls_pspinlock_t; typedef os_unfair_lock ls_pspinlock_t;
#define ls_pspinlock_lock OSSpinLockLock #define ls_pspinlock_lock os_unfair_lock_lock
#define ls_pspinlock_trylock OSSpinLockTry #define ls_pspinlock_trylock os_unfair_lock_trylock
#define ls_pspinlock_unlock OSSpinLockUnlock #define ls_pspinlock_unlock os_unfair_lock_unlock
#else #else
typedef pthread_spinlock_t ls_pspinlock_t; typedef pthread_spinlock_t ls_pspinlock_t;
#define ls_pspinlock_lock pthread_spin_lock #define ls_pspinlock_lock pthread_spin_lock
#define ls_pspinlock_trylock pthread_spin_trylock #define ls_pspinlock_trylock pthread_spin_trylock
#define ls_pspinlock_unlock pthread_spin_unlock #define ls_pspinlock_unlock pthread_spin_unlock
#endif #endif
#if defined(__i386__) || defined(__ia64__) || defined(__x86_64) || defined(__x86 _64__) #if defined(__i386__) || defined(__ia64__) || defined(__x86_64) || defined(__x86 _64__)
//#define cpu_relax() asm volatile("pause\n": : :"memory") //#define cpu_relax() asm volatile("pause\n": : :"memory")
// ron - the PAUSE approach is order of magnitude slower in MT with contention // ron - the PAUSE approach is order of magnitude slower in MT with contention
skipping to change at line 192 skipping to change at line 192
} }
ls_inline int ls_futex_wait(int *futex, int val, struct timespec *timeout) ls_inline int ls_futex_wait(int *futex, int val, struct timespec *timeout)
{ {
int err = _umtx_op(futex, UMTX_OP_WAIT_UINT, val, 0, (void *)timeout); int err = _umtx_op(futex, UMTX_OP_WAIT_UINT, val, 0, (void *)timeout);
return err; return err;
} }
#endif #endif
#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#define ls_futex_wait_priv ls_futex_wait
#define ls_futex_wake_priv ls_futex_wake
#define ls_futex_wakeall_priv ls_futex_wakeall
ls_inline int ls_futex_wake(int *futex)
{
//Not implemented for MAC OS
return 0;
}
ls_inline int ls_futex_wakeall(int *futex)
{
//Not implemented for MAC OS
return 0;
}
ls_inline int ls_futex_wait(int *futex, int val, struct timespec *timeout)
{
usleep(1000);
return 0;
}
#endif
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_li nux__) #if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_li nux__)
ls_inline int ls_futex_wake(int *futex) ls_inline int ls_futex_wake(int *futex)
{ {
return syscall(SYS_futex, futex, FUTEX_WAKE, 1, NULL, NULL, 0); return syscall(SYS_futex, futex, FUTEX_WAKE, 1, NULL, NULL, 0);
} }
ls_inline int ls_futex_wakeall(int *futex) ls_inline int ls_futex_wakeall(int *futex)
{ {
return syscall(SYS_futex, futex, FUTEX_WAKE, INT_MAX, NULL, NULL, 0); return syscall(SYS_futex, futex, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
 End of changes. 2 change blocks. 
5 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)