#include <libkern/OSAtomic.h>
#include <sys/mman.h>
#include <errno.h>
+#include <os/lock.h>
#define __APPLE_API_PRIVATE
#include <machine/cpu_capabilities.h>
size_t turnoff;
dispatch_queue_t queue;
dispatch_group_t group;
- OSSpinLock sharedlock;
+ os_unfair_lock sharedlock;
};
static union args *
{
union args *args;
- OSSpinLockLock(&shared->sharedlock);
+ os_unfair_lock_lock(&shared->sharedlock);
if(!shared->freelist) {
struct page *page;
union args *prev;
}
args = shared->freelist;
shared->freelist = args->next;
- OSSpinLockUnlock(&shared->sharedlock);
+ os_unfair_lock_unlock(&shared->sharedlock);
return args;
}
static void
returnargs(struct shared *shared, union args *args)
{
- OSSpinLockLock(&shared->sharedlock);
+ os_unfair_lock_lock(&shared->sharedlock);
args->next = shared->freelist;
shared->freelist = args;
- OSSpinLockUnlock(&shared->sharedlock);
+ os_unfair_lock_unlock(&shared->sharedlock);
}
/*
union args *args;
bzero(&shared, sizeof(shared));
- shared.sharedlock = OS_SPINLOCK_INIT;
+ shared.sharedlock = OS_UNFAIR_LOCK_INIT;
if ((args = getargs(&shared)) != NULL) {
struct page *p, *pp;
#ifdef I_AM_PSORT_R