aboutsummaryrefslogtreecommitdiff
path: root/nptl/sem_post.c
AgeCommit message (Collapse)AuthorFilesLines
2015-07-10Add and use new glibc-internal futex API.Torvald Riegel1-26/+2
This adds new functions for futex operations, starting with wait, abstimed_wait, reltimed_wait, wake. They add documentation and error checking according to the current draft of the Linux kernel futex manpage. Waiting with absolute or relative timeouts is split into separate functions. This allows for removing a few cases of code duplication in pthreads code, which uses absolute timeouts; also, it allows us to put platform-specific code to go from an absolute to a relative timeout into the platform-specific futex abstractions.. Futex operations that can be canceled are also split out into separate functions suffixed by "_cancelable". There are separate versions for both Linux and NaCl; while they currently differ only slightly, my expectation is that the separate versions of lowlevellock-futex.h will eventually be merged into futex-internal.h when we get to move the lll_ functions over to the new futex API.
2015-05-19BZ#18434: Fix sem_post EOVERFLOW check for [!__HAVE_64B_ATOMICS].Roland McGrath1-3/+3
2015-01-23Use uint64_t and (uint64_t) 1 for 64-bit intH.J. Lu1-1/+1
This patch replaces unsigned long int and 1UL with uint64_t and (uint64_t) 1 to support ILP32 targets like x32. [BZ #17870] * nptl/sem_post.c (__new_sem_post): Replace unsigned long int with uint64_t. * nptl/sem_waitcommon.c (__sem_wait_cleanup): Replace 1UL with (uint64_t) 1. (__new_sem_wait_slow): Replace unsigned long int with uint64_t. Replace 1UL with (uint64_t) 1. * sysdeps/nptl/internaltypes.h (new_sem): Replace unsigned long int with uint64_t.
2015-01-21Fix semaphore destruction (bug 12674).Carlos O'Donell1-10/+57
This commit fixes semaphore destruction by either using 64b atomic operations (where available), or by using two separate fields when only 32b atomic operations are available. In the latter case, we keep a conservative estimate of whether there are any waiting threads in one bit of the field that counts the number of available tokens, thus allowing sem_post to atomically both add a token and determine whether it needs to call futex_wake. See: https://sourceware.org/ml/libc-alpha/2014-12/msg00155.html
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers1-1/+1
2014-07-07Get rid of nptl/sysdeps/ entirely!Roland McGrath1-0/+80