diff --git a/include/metalsvm/spinlock.h b/include/metalsvm/spinlock.h index 50909bf8..af4a973d 100644 --- a/include/metalsvm/spinlock.h +++ b/include/metalsvm/spinlock.h @@ -92,12 +92,16 @@ inline static int spinlock_lock(spinlock_t* s) { return 0; } +#if 0 ticket = atomic_int32_inc(&s->queue); while(atomic_int32_read(&s->dequeue) != ticket) { NOP1; } s->owner = curr_task->id; s->counter = 1; +#else + while( atomic_int32_test_and_set(&s->dequeue,0) ); +#endif return 0; } @@ -114,7 +118,11 @@ inline static int spinlock_unlock(spinlock_t* s) { s->counter--; if (!s->counter) { s->owner = MAX_TASKS; +#if 0 atomic_int32_inc(&s->dequeue); +#else + atomic_int32_set(&s->dequeue,1); +#endif } return 0;