summaryrefslogtreecommitdiff
path: root/sysdeps/generic/pt-mutex-trylock.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2005-05-02 22:00:34 +0000
committerNeal H. Walfield <neal@gnu.org>2005-05-02 22:00:34 +0000
commit6c7755ebb4718153b144b59f9becbf1b5e785f02 (patch)
tree8ee76a9219839b5ae4f2537fc13a021463c33849 /sysdeps/generic/pt-mutex-trylock.c
parent3f126cc9b3b8fb6f98dd4bdbe4f69f89ec7ab1a4 (diff)
libpthread/
2005-05-02 Neal H. Walfield <neal@gnu.org> * pthread/pt-alloc.c (__pthread_alloc): Set the thread id to the table index plus one. * pthread/pt-internal.h (__pthread_getid): Index __pthread_threads using THREAD - 1, not THREAD. (__pthread_setid): Likewise. * pthread/pt-create.c (__pthread_create_internal): Likewise. * sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock): When returning EBUSY, don't forget to first unlock MUTEX->__HELD.
Diffstat (limited to 'sysdeps/generic/pt-mutex-trylock.c')
-rw-r--r--sysdeps/generic/pt-mutex-trylock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/generic/pt-mutex-trylock.c b/sysdeps/generic/pt-mutex-trylock.c
index b3c3fe3a..9457ddac 100644
--- a/sysdeps/generic/pt-mutex-trylock.c
+++ b/sysdeps/generic/pt-mutex-trylock.c
@@ -1,5 +1,5 @@
/* Try to Lock a mutex. Generic version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
#define LOSE do { * (int *) 0 = 0; } while (1)
-/* Lock MUTEX, block if we can't get it. */
+/* Lock MUTEX, return EBUSY if we can't get it. */
int
__pthread_mutex_trylock (struct __pthread_mutex *mutex)
{
@@ -82,6 +82,8 @@ __pthread_mutex_trylock (struct __pthread_mutex *mutex)
}
}
+ __pthread_spin_unlock (&mutex->__lock);
+
return err;
}