summary refs log tree commit diff
path: root/linuxthreads/rwlock.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-04-13 05:57:21 +0000
committerUlrich Drepper <drepper@redhat.com>2000-04-13 05:57:21 +0000
commitd8d914df6806c6057b20c7311cad0bc2ac201c03 (patch)
tree6d2512373ef92b0abbebd4e0d0761cdd9715ea0b /linuxthreads/rwlock.c
parentb3ae0650bcff54f12d87f878000d4c488b365bf7 (diff)
downloadglibc-d8d914df6806c6057b20c7311cad0bc2ac201c03.tar.gz
glibc-d8d914df6806c6057b20c7311cad0bc2ac201c03.tar.xz
glibc-d8d914df6806c6057b20c7311cad0bc2ac201c03.zip
Update.
	* sysdeps/pthread/pthread.h: Add prototypes for pthread_spin_init,
	pthread_spin_destroy, pthread_spin_lock, pthread_spin_trylock,
	and pthread_spin_unlock.
	* sysdeps/pthread/bits/pthreadtypes.h: Change struct _pthread_fastlock
	into pthread_spinlock_t.  Change all uses.
	* spinlock.c: Implement pthread_spin_lock.
	Rename __pthread_unlock to __pthread_spin_unlock and define weak
	alias for real name.
	Define pthread_spin_trylock, pthread_spin_init, and
	pthread_spin_destroy.
	Change all uses of _pthread_fastlock to pthread_spinlock_t.
	* spinlock.h: Rename __pthread_unlock to __pthread_spin_unlock.
	Change all uses of _pthread_fastlock to pthread_spinlock_t.
	* Versions [libpthread] (GLIBC_2.2): Add pthread_spin_init,
	pthread_spin_destroy, pthread_spin_lock, pthread_spin_trylock,
	and pthread_spin_unlock.
	* cancel.c: Use __pthread_spin_unlock instead of __pthread_unlock.
	Change all uses of _pthread_fastlock to pthread_spinlock_t.
	* condvar.c: Likewise.
	* internals.h: Likewise.
	* join.c: Likewise.
	* manager.c: Likewise.
	* mutex.c: Likewise.
	* pthread.c: Likewise.
	* rwlock.c: Likewise.
	* semaphore.c: Likewise.
	* signals.c: Likewise.
Diffstat (limited to 'linuxthreads/rwlock.c')
-rw-r--r--linuxthreads/rwlock.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/linuxthreads/rwlock.c b/linuxthreads/rwlock.c
index 9da87d25d1..e4a4c81f8c 100644
--- a/linuxthreads/rwlock.c
+++ b/linuxthreads/rwlock.c
@@ -217,7 +217,7 @@ __pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
   __pthread_lock (&rwlock->__rw_lock, NULL);
   readers = rwlock->__rw_readers;
   writer = rwlock->__rw_writer;
-  __pthread_unlock (&rwlock->__rw_lock);
+  __pthread_spin_unlock (&rwlock->__rw_lock);
 
   if (readers > 0 || writer != NULL)
     return EBUSY;
@@ -247,12 +247,12 @@ __pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
 	break;
 
       enqueue (&rwlock->__rw_read_waiting, self);
-      __pthread_unlock (&rwlock->__rw_lock);
+      __pthread_spin_unlock (&rwlock->__rw_lock);
       suspend (self); /* This is not a cancellation point */
     }
 
   ++rwlock->__rw_readers;
-  __pthread_unlock (&rwlock->__rw_lock);
+  __pthread_spin_unlock (&rwlock->__rw_lock);
 
   if (have_lock_already || out_of_mem)
     {
@@ -291,7 +291,7 @@ __pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
       retval = 0;
     }
 
-  __pthread_unlock (&rwlock->__rw_lock);
+  __pthread_spin_unlock (&rwlock->__rw_lock);
 
   if (retval == 0)
     {
@@ -320,13 +320,13 @@ __pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
       if (rwlock->__rw_readers == 0 && rwlock->__rw_writer == NULL)
 	{
 	  rwlock->__rw_writer = self;
-	  __pthread_unlock (&rwlock->__rw_lock);
+	  __pthread_spin_unlock (&rwlock->__rw_lock);
 	  return 0;
 	}
 
       /* Suspend ourselves, then try again */
       enqueue (&rwlock->__rw_write_waiting, self);
-      __pthread_unlock (&rwlock->__rw_lock);
+      __pthread_spin_unlock (&rwlock->__rw_lock);
       suspend (self); /* This is not a cancellation point */
     }
 }
@@ -344,7 +344,7 @@ __pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
       rwlock->__rw_writer = thread_self ();
       result = 0;
     }
-  __pthread_unlock (&rwlock->__rw_lock);
+  __pthread_spin_unlock (&rwlock->__rw_lock);
 
   return result;
 }
@@ -363,7 +363,7 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
       /* Unlocking a write lock.  */
       if (rwlock->__rw_writer != thread_self ())
 	{
-	  __pthread_unlock (&rwlock->__rw_lock);
+	  __pthread_spin_unlock (&rwlock->__rw_lock);
 	  return EPERM;
 	}
       rwlock->__rw_writer = NULL;
@@ -375,14 +375,14 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
 	  /* Restart all waiting readers.  */
 	  torestart = rwlock->__rw_read_waiting;
 	  rwlock->__rw_read_waiting = NULL;
-	  __pthread_unlock (&rwlock->__rw_lock);
+	  __pthread_spin_unlock (&rwlock->__rw_lock);
 	  while ((th = dequeue (&torestart)) != NULL)
 	    restart (th);
 	}
       else
 	{
 	  /* Restart one waiting writer.  */
-	  __pthread_unlock (&rwlock->__rw_lock);
+	  __pthread_spin_unlock (&rwlock->__rw_lock);
 	  restart (th);
 	}
     }
@@ -391,7 +391,7 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
       /* Unlocking a read lock.  */
       if (rwlock->__rw_readers == 0)
 	{
-	  __pthread_unlock (&rwlock->__rw_lock);
+	  __pthread_spin_unlock (&rwlock->__rw_lock);
 	  return EPERM;
 	}
 
@@ -402,7 +402,7 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
       else
 	th = NULL;
 
-      __pthread_unlock (&rwlock->__rw_lock);
+      __pthread_spin_unlock (&rwlock->__rw_lock);
       if (th != NULL)
 	restart (th);