- 01 4月, 2011 1 次提交
-
-
由 Rich Felker 提交于
-
- 30 3月, 2011 5 次提交
-
-
由 Rich Felker 提交于
unlocking an unlocked mutex is not UB for robust or error-checking mutexes, so we must avoid calling __pthread_self (which might crash due to lack of thread-register initialization) until after checking that the mutex is locked.
-
由 Rich Felker 提交于
this roughly halves the cost of pthread_mutex_unlock, at least for non-robust, normal-type mutexes. the a_store change is in preparation for future support of archs which require a memory barrier or special atomic store operation, and also should prevent the possibility of the compiler misordering writes.
-
由 Rich Felker 提交于
cycle-level benchmark on atom cpu showed typical pthread_mutex_lock call dropping from ~120 cycles to ~90 cycles with this change. benefit may vary with compiler options and version, but this optimization is very cheap to make and should always help some.
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
- there is no longer any risk of spoofing cancellation requests, since the cancel flag is set in pthread_cancel rather than in the signal handler. - cancellation signal is no longer unblocked when running the cancellation handlers. instead, pthread_create will cause any new threads created from a cancellation handler to unblock their own cancellation signal. - various tweaks in preparation for POSIX timer support.
-
- 29 3月, 2011 2 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
actually this trick also seems to have made the uncontended case slower.
-
- 26 3月, 2011 1 次提交
-
-
由 Rich Felker 提交于
glibc made the ridiculous choice to use pass-by-register calling convention for these functions, which is impossible to duplicate directly on non-gcc compilers. instead, we use ugly asm to wrap and convert the calling convention. presumably this works with every compiler anyone could potentially want to use.
-
- 25 3月, 2011 4 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
this commit addresses two issues: 1. a race condition, whereby a cancellation request occurring after a syscall returned from kernelspace but before the subsequent CANCELPT_END would cause cancellable resource-allocating syscalls (like open) to leak resources. 2. signal handlers invoked while the thread was blocked at a cancellation point behaved as if asynchronous cancellation mode wer in effect, resulting in potentially dangerous state corruption if a cancellation request occurs. the glibc/nptl implementation of threads shares both of these issues. with this commit, both are fixed. however, cancellation points encountered in a signal handler will not be acted upon if the signal was received while the thread was already at a cancellation point. they will of course be acted upon after the signal handler returns, so in real-world usage where signal handlers quickly return, it should not be a problem. it's possible to solve this problem too by having sigaction() wrap all signal handlers with a function that uses a pthread_cleanup handler to catch cancellation, patch up the saved context, and return into the cancellable function that will catch and act upon the cancellation. however that would be a lot of complexity for minimal if any benefit...
-
- 20 3月, 2011 4 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
with this patch, the syscallN() functions are no longer needed; a variadic syscall() macro allows syscalls with anywhere from 0 to 6 arguments to be made with a single macro name. also, manually casting each non-integer argument with (long) is no longer necessary; the casts are hidden in the macros. some source files which depended on being able to define the old macro SYSCALL_RETURNS_ERRNO have been modified to directly use __syscall() instead of syscall(). references to SYSCALL_SIGSET_SIZE and SYSCALL_LL have also been changed. x86_64 has not been tested, and may need a follow-up commit to fix any minor bugs/oversights.
-
由 Rich Felker 提交于
this commit shuffles around the location of syscall definitions so that we can make a syscall() library function with both SYS_* and __NR_* style syscall names available to user applications, provides the syscall() library function, and optimizes the code that performs the actual inline syscalls in the library itself. previously on i386 when built as PIC (shared library), syscalls were incurring bus lock (lock prefix) overhead at entry and exit, due to the way the ebx register was being loaded (xchg instruction with a memory operand). now the xchg takes place between two registers. further cleanup to arch/$(ARCH)/syscall.h is planned.
-
- 18 3月, 2011 4 次提交
-
-
由 Rich Felker 提交于
some of this code should be cleaned up, e.g. using macros for some of the bit flags, masks, etc. nonetheless, the code is believed to be working and correct at this point.
-
由 Rich Felker 提交于
if the mutex was previously locked, we can assume pthread_self was already called at the time of locking, and thus that the thread pointer is initialized.
-
由 Rich Felker 提交于
this change is necessary to free up one slot in the mutex structure so that we can use doubly-linked lists in the implementation of robust mutexes.
-
由 Rich Felker 提交于
-
- 17 3月, 2011 2 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
- 16 3月, 2011 2 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
- 13 3月, 2011 1 次提交
-
-
由 Rich Felker 提交于
-
- 11 3月, 2011 7 次提交
-
-
由 Rich Felker 提交于
for some reason these functions are not shaded by the PS/TPS option in POSIX, so presumably they are mandatory, even though the functionality they offer is optional. for now, provide them in case any programs depend on their existence, but disallow any priority except the default.
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
multiple opens of the same named semaphore must return the same pointer, and only the last close can unmap it. thus the ugly global state keeping track of mappings. the maximum number of distinct named semaphores that can be opened is limited sufficiently small that the linear searches take trivial time, especially compared to the syscall overhead of these functions.
-
由 Rich Felker 提交于
we can avoid blocking signals by simply using a flag to mark that the thread has exited and prevent it from getting counted in the rsyscall signal-pingpong. this restores the original pthread create/join throughput from before the sigprocmask call was added.
-
由 Rich Felker 提交于
-
- 10 3月, 2011 2 次提交
-
-
由 Rich Felker 提交于
it must return errno, not -1, and should reject invalud values for how.
-
由 Rich Felker 提交于
the set_tid_address returns the tid (which is also the pid when called from the initial thread) so there is no need to make a separate syscall to get pid/tid.
-
- 09 3月, 2011 3 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
the issue was a break statement that was breaking only from the switch, not the enclosing for loop, and a failure to set the final success state.
-
- 08 3月, 2011 2 次提交
-
-
由 Rich Felker 提交于
problem 1: mutex type from the attribute was being ignored by pthread_mutex_init, so recursive/errorchecking mutexes were never being used at all. problem 2: ownership of recursive mutexes was not being enforced at unlock time.
-
由 Rich Felker 提交于
-