bug in ticket lock! => switch (temporary) to a "normal" spinlock
This commit is contained in:
parent
297421e29d
commit
5e047d6b96
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue