path: root/src/thread/pthread_self.c
AgeCommit message (Collapse)AuthorLines
2011-04-20fix minor bugs due to incorrect threaded-predicate semanticsRich Felker-4/+2
some functions that should have been testing whether pthread_self() had been called and initialized the thread pointer were instead testing whether pthread_create() had been called and actually made the program "threaded". while it's unlikely any mismatch would occur in real-world problems, this could have introduced subtle bugs. now, we store the address of the main thread's thread descriptor in the libc structure and use its presence as a flag that the thread register is initialized. note that after fork, the calling thread (not necessarily the original main thread) is the new main thread.
2011-04-17debloat: use __syscall instead of syscall where possibleRich Felker-1/+1
don't waste time (and significant code size due to function call overhead!) setting errno when the result of a syscall does not matter or when it can't fail.
2011-04-17optimize cancellation enable/disable codeRich Felker-0/+1
the goal is to be able to use pthread_setcancelstate internally in the implementation, whenever a function might want to use functions which are cancellation points but avoid becoming a cancellation point itself. i could have just used a separate internal function for temporarily inhibiting cancellation, but the solution in this commit is better because (1) it's one less implementation-specific detail in functions that need to use it, and (2) application code can also get the same benefit. previously, pthread_setcancelstate dependend on pthread_self, which would pull in unwanted thread setup overhead for non-threaded programs. now, it temporarily stores the state in the global libc struct if threads have not been initialized, and later moves it if needed. this way we can instead use __pthread_self, which has no dependencies and assumes that the thread register is already valid.
2011-04-01use bss instead of mmap for main thread's pthread thread-specific dataRich Felker-9/+3
this simplifies code and removes a failure case
2011-03-20global cleanup to use the new syscall interfaceRich Felker-1/+1
2011-03-09optimize pthread initializationRich Felker-2/+2
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.
2011-03-03optimize POSIX TSD for fast pthread_getspecificRich Felker-0/+11
2011-02-15finish unifying thread register handling in preparation for portingRich Felker-9/+3
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+39