svn commit: trunk/uClibc/libpthread/linuxthreads
vapier at uclibc.org
vapier at uclibc.org
Thu Sep 8 03:00:12 UTC 2005
Author: vapier
Date: 2005-09-07 20:00:11 -0700 (Wed, 07 Sep 2005)
New Revision: 11380
Log:
sync with glibc and remove duplicated SEM_VALUE_MAX define
Modified:
trunk/uClibc/libpthread/linuxthreads/oldsemaphore.c
Changeset:
Modified: trunk/uClibc/libpthread/linuxthreads/oldsemaphore.c
===================================================================
--- trunk/uClibc/libpthread/linuxthreads/oldsemaphore.c 2005-09-08 02:59:43 UTC (rev 11379)
+++ trunk/uClibc/libpthread/linuxthreads/oldsemaphore.c 2005-09-08 03:00:11 UTC (rev 11380)
@@ -32,9 +32,6 @@
int sem_spinlock;
} old_sem_t;
-/* Maximum value the semaphore can have. */
-#define SEM_VALUE_MAX ((int) ((~0u) >> 1))
-
static inline int sem_compare_and_swap(old_sem_t *sem, long oldval, long newval)
{
return compare_and_swap(&sem->sem_status, oldval, newval, &sem->sem_spinlock);
@@ -63,7 +60,7 @@
errno = ENOSYS;
return -1;
}
- sem->sem_spinlock = 0;
+ sem->sem_spinlock = __LT_SPINLOCK_INIT;
sem->sem_status = ((long)value << 1) + 1;
return 0;
}
@@ -90,7 +87,7 @@
while (1) {
/* Register extrication interface */
- __pthread_set_own_extricate_if(self, &extr);
+ __pthread_set_own_extricate_if(self, &extr);
do {
oldstatus = sem->sem_status;
if ((oldstatus & 1) && (oldstatus != 1))
@@ -103,12 +100,13 @@
while (! sem_compare_and_swap(sem, oldstatus, newstatus));
if (newstatus & 1) {
/* We got the semaphore. */
- __pthread_set_own_extricate_if(self, 0);
+ __pthread_set_own_extricate_if(self, 0);
+ self->p_nextwaiting = NULL;
return 0;
}
/* Wait for sem_post or cancellation */
suspend(self);
- __pthread_set_own_extricate_if(self, 0);
+ __pthread_set_own_extricate_if(self, 0);
/* This is a cancellation point */
if (self->p_canceled && self->p_cancelstate == PTHREAD_CANCEL_ENABLE) {
More information about the uClibc-cvs
mailing list