diff options
author | Eric Andersen <andersen@codepoet.org> | 2005-05-20 19:02:51 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2005-05-20 19:02:51 +0000 |
commit | 124af9f4b2b77b1510d88cfc8092c788d7e513c7 (patch) | |
tree | ccce720bef4c1c604417e2082cf9997a8d6dd7ab /libpthread/nptl/DESIGN-sem.txt | |
parent | 8028f35dbe29c5ace3883005e08ac91d873553b2 (diff) |
Back out nptl changes, which for now will be done in branches/uClibc-nptl
Diffstat (limited to 'libpthread/nptl/DESIGN-sem.txt')
-rw-r--r-- | libpthread/nptl/DESIGN-sem.txt | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/libpthread/nptl/DESIGN-sem.txt b/libpthread/nptl/DESIGN-sem.txt deleted file mode 100644 index 17eb0c11c..000000000 --- a/libpthread/nptl/DESIGN-sem.txt +++ /dev/null @@ -1,46 +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 count; - - current semaphore count, also used as a futex -} - -sem_wait(sem_t *sem) -{ - for (;;) { - - if (atomic_decrement_if_positive(sem->count)) - break; - - futex_wait(&sem->count, 0) - } -} - -sem_post(sem_t *sem) -{ - n = atomic_increment(sem->count); - // Pass the new value of sem->count - futex_wake(&sem->count, n + 1); -} - -sem_trywait(sem_t *sem) -{ - if (atomic_decrement_if_positive(sem->count)) { - return 0; - } else { - return EAGAIN; - } -} - -sem_getvalue(sem_t *sem, int *sval) -{ - *sval = sem->count; - read_barrier(); -} |