wrflock_init.cpp
412 Bytes
#include "wrflock.h"
int wrflock_init (wrflock_t *lock, int waittype, int pshared) {
lock->data64 = (pshared==0?WRFLOCK_PRIVATE_MASK_64:0) | NEXTSTATE_WRITE_MASK_64;
lock->data64 |= (waittype&WRFLOCK_WWAITYIELD)?WRFLOCK_WWAITYIELD_MASK_64:0;
lock->data64 |= (waittype&WRFLOCK_RWAITYIELD)?WRFLOCK_RWAITYIELD_MASK_64:0;
lock->data64 |= (waittype&WRFLOCK_FWAITYIELD)?WRFLOCK_FWAITYIELD_MASK_64:0;
return 0;
}