summaryrefslogtreecommitdiff
path: root/nptl/DESIGN-sem-old.txt
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-03 21:57:42 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-03 21:57:42 +0000
commit3e4fc359f4fab31607703b311857c58f08ebf67c (patch)
treeb0b004b870040cce25190a6f833a02f2580884af /nptl/DESIGN-sem-old.txt
parent4f088329f3418ca19e3da0d5571433ea3b172616 (diff)
downloadglibc-3e4fc359f4fab31607703b311857c58f08ebf67c.tar
glibc-3e4fc359f4fab31607703b311857c58f08ebf67c.tar.gz
glibc-3e4fc359f4fab31607703b311857c58f08ebf67c.tar.bz2
glibc-3e4fc359f4fab31607703b311857c58f08ebf67c.zip
Update.
2003-01-31 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c: Include kernel-features.h * sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S: Likewise.
Diffstat (limited to 'nptl/DESIGN-sem-old.txt')
-rw-r--r--nptl/DESIGN-sem-old.txt67
1 files changed, 0 insertions, 67 deletions
diff --git a/nptl/DESIGN-sem-old.txt b/nptl/DESIGN-sem-old.txt
deleted file mode 100644
index 2db2f35ce2..0000000000
--- a/nptl/DESIGN-sem-old.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-Semaphores pseudocode
-==============================
-
- int sem_wait(sem_t * sem);
- int sem_trywait(sem_t * sem);
- int sem_post(sem_t * sem);
- int sem_getvalue(sem_t * sem, int * sval);
-
-struct sem_t {
-
- unsigned int lock:
- - internal mutex
-
- unsigned int count;
- - current semaphore count, also used as a futex
-
- unsigned int waiters;
- - number of threads queued in sem_wait().
-}
-
-sem_wait(sem_t *sem)
-{
- lll_lock(sem->lock);
- for (;;) {
-
- if (sem->count)
- break;
-
- sem->waiters++;
- lll_unlock(sem->lock);
-
- futex_wait(&sem->count, 0)
-
- lll_lock(sem->lock);
- sem->waiters--;
- }
- sem->count--;
- lll_unlock(sem->lock);
-}
-
-sem_post(sem_t *sem)
-{
- lll_lock(sem->lock);
- sem->count++;
- if (sem->waiters)
- futex_wake(&sem->count, sem->count);
- lll_unlock(sem->lock);
-}
-
-sem_trywait(sem_t *sem)
-{
- lll_lock(sem->lock);
- if (sem->count) {
- sem->count--;
- lll_unlock(sem->lock);
- return 0;
- } else {
- lll_unlock(sem->lock);
- return -EAGAIN;
- }
-}
-
-sem_getvalue(sem_t *sem, int *sval)
-{
- *sval = sem->count;
- read_barrier();
-}