mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 03:10:05 +00:00
Update.
* spinlock.c (__pthread_unlock): Don"t crash if called for an untaken mutex. Reported by Ruslan V. Brushkoff <rus@Snif.Te.Net.UA>.
This commit is contained in:
parent
60876a7544
commit
fbaf6e72d6
@ -1,5 +1,8 @@
|
|||||||
1998-12-14 Ulrich Drepper <drepper@cygnus.com>
|
1998-12-14 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* spinlock.c (__pthread_unlock): Don"t crash if called for an
|
||||||
|
untaken mutex. Reported by Ruslan V. Brushkoff <rus@Snif.Te.Net.UA>.
|
||||||
|
|
||||||
* Examples/ex6.c: Unbuffer stdout and reduce sleep time to reduce
|
* Examples/ex6.c: Unbuffer stdout and reduce sleep time to reduce
|
||||||
overall runtime.
|
overall runtime.
|
||||||
|
|
||||||
|
@ -65,9 +65,11 @@ void internal_function __pthread_unlock(struct _pthread_fastlock * lock)
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
oldstatus = lock->__status;
|
oldstatus = lock->__status;
|
||||||
if (oldstatus == 1) {
|
if (oldstatus == 0 || oldstatus == 1) {
|
||||||
/* No threads are waiting for this lock */
|
/* No threads are waiting for this lock. Please note that we also
|
||||||
if (! compare_and_swap(&lock->__status, 1, 0, &lock->__spinlock))
|
enter this case if the lock is not taken at all. If this wouldn't
|
||||||
|
be done here we would crash further down. */
|
||||||
|
if (! compare_and_swap(&lock->__status, oldstatus, 0, &lock->__spinlock))
|
||||||
goto again;
|
goto again;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user