aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/spinlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/spinlock.c')
-rw-r--r--linuxthreads/spinlock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 2546e2a..8a8d3bf 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -47,9 +47,10 @@ void __pthread_lock(struct _pthread_fastlock * lock)
newstatus = 1;
} else {
self = thread_self();
- self->p_nextwaiting = (pthread_descr) oldstatus;
newstatus = (long) self;
}
+ if (self != NULL)
+ self->p_nextwaiting = (pthread_descr) oldstatus;
} while(! compare_and_swap(&lock->status, oldstatus, newstatus,
&lock->spinlock));
if (oldstatus != 0) suspend(self);