aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread_exit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix possible leak in pthread_detach.Yabin Cui2015-01-151-0/+3
| | | | | | | | | If pthread_detach() is called while the thread is in pthread_exit(), it takes the risk that no one can free the pthread_internal_t. So I add PTHREAD_ATTR_FLAG_ZOMBIE to detect this, maybe very rare, but both glibc and netbsd libpthread have similar function. Change-Id: Iaa15f651903b8ca07aaa7bd4de46ff14a2f93835
* Remove PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK.Yabin Cui2015-01-061-14/+9
| | | | | | Patch for https://android-review.googlesource.com/#/c/120844/. Change-Id: Idca5ccd7b28e8f07f1d2d1b6e3bba6781b62f0e0
* Reserve enough user request stack space in pthread_create.Yabin Cui2015-01-021-1/+1
| | | | | Bug: 18830897 Change-Id: I1ba4aaeaf66a7ff99c5d82ad45469011171b0a3b
* Use mmap to create the pthread_internal_tYabin Cui2014-12-191-15/+11
| | | | | | | | | Add name to mmaped regions. Add pthread benchmark code. Allocate pthread_internal_t on regular stack. Bug: 16847284 Change-Id: Id60835163bb0d68092241f1a118015b5a8f85069
* Use mmap to create the pthread_internal_t.Yabin Cui2014-12-021-6/+0
| | | | | Bug: 16847284 Change-Id: I488fa236f57aa3acb29b4ffbbab2fab51b0653be
* Revert "Use mmap to create the pthread_internal_t."Nicolas Geoffray2014-11-261-4/+6
| | | | | | | | | | | | Unfortunately, this change provokes random crashes for ART, and I have seen libc crashes on the device that might be related to it. Reverting it fixes the ART crashes. there is unfortunately no stack trace for the crashes, but just a "Segmentation fault" message. This reverts commit cc5f6543e3f91385b9a912438965b7e8265df54a. Change-Id: I68dca8e1e9b9edcce7eb84596e8db619e40e8052
* Use mmap to create the pthread_internal_t.Yabin Cui2014-11-251-6/+4
| | | | | Bug: 16847284 Change-Id: Ic8c85f95afac1d8422ecb69674c688d1fecb6a44
* Do a second key cleanup in pthread_exit.Christopher Ferris2014-08-061-0/+6
| | | | | | | | | | | | | | | | During pthread_exit, the keys are cleaned. Unfortunately, a call to free occurs after the cleanup and the memory for some of the keys is recreated when using jemalloc. The solution is to do the key cleanup twice. Also, modify the pthread_detach__leak test to be less flaky when run on a jemalloc system. Bug: 16513133 (cherry picked from commit 18d93f2793fad393b6aa6eae6afe1054958339d5) Change-Id: Idb32e7f9b09e2c088d256ed9eb881df80c81ff8e
* Only wipe TLS for user-supplied stacks.Elliott Hughes2014-07-301-1/+1
| | | | | Bug: 16667988 Change-Id: Id180ab2bc6713e1612386120a306db5bbf1d6046
* Add some missing __noreturn attributes.Elliott Hughes2014-05-301-5/+2
| | | | | | This is more honest, and lets us remove a hack. Change-Id: I309f064743ded5248573ccafc379f78d417db08d
* Switch to g_ for globals.Elliott Hughes2014-05-141-2/+2
| | | | | | | That's what the Google style guide recommends, and we're starting to get a mix. Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
* Remove the bogus exit status from _exit_with_stack_teardown.Elliott Hughes2013-12-211-2/+2
| | | | | | | It should always be 0, and there's no reason to pass a constant in as an argument. Change-Id: I92ac59b718a18e298bd7c52821af447f9181ca2a
* Clarify a comment.Elliott Hughes2013-12-111-3/+3
| | | | Change-Id: Iad2e33fb059170f808023ce3d17e9b8c13191f42
* Do not clear tids on detached threads.Christopher Ferris2013-12-061-0/+4
| | | | | | | | Make sure that the kernel isn't going to try and clear the tid of freed memory. Bug: 11963327 Change-Id: I95d02340bfbe92f56036d2cc58dbf0e3079eb7c3
* Fix pthread_join.Elliott Hughes2013-11-181-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Let the kernel keep pthread_internal_t::tid updated, including across forks and for the main thread. This then lets us fix pthread_join to only return after the thread has really exited. Also fix the thread attributes of the main thread so we don't unmap the main thread's stack (which is really owned by the dynamic linker and contains things like environment variables), which fixes crashes when joining with an exited main thread and also fixes problems reported publicly with accessing environment variables after the main thread exits (for which I've added a new unit test). In passing I also fixed a bug where if the clone(2) inside pthread_create(3) fails, we'd unmap the child's stack and TLS (which contains the mutex) and then try to unlock the mutex. Boom! It wasn't until after I'd uploaded the fix for this that I came across a new public bug reporting this exact failure. Bug: 8206355 Bug: 11693195 Bug: https://code.google.com/p/android/issues/detail?id=57421 Bug: https://code.google.com/p/android/issues/detail?id=62392 Change-Id: I2af9cf6e8ae510a67256ad93cad891794ed0580b
* Prepare to switch to the uapi <linux/signal.h>.Elliott Hughes2013-11-071-0/+1
| | | | | | | | | | <time.h> didn't need to copy the cruft from <signal.h>, and <signal.h> only needs the uid_t hack when it's not using uapi headers. pthread_exit.cpp should include what it uses. Change-Id: I836c36abe0f0a781d41fc425b249d1c7686bb124
* <pthread.h> fixes and pthread cleanup.Elliott Hughes2013-10-311-0/+135
<pthread.h> was missing nonnull attributes, noreturn on pthread_exit, and had incorrect cv qualifiers for several standard functions. I've also marked the non-standard stuff (where I count glibc rather than POSIX as "standard") so we can revisit this cruft for LP64 and try to ensure we're compatible with glibc. I've also broken out the pthread_cond* functions into a new file. I've made the remaining pthread files (plus ptrace) part of the bionic code and fixed all the warnings. I've added a few more smoke tests for chunks of untested pthread functionality. We no longer need the libc_static_common_src_files hack for any of the pthread implementation because we long since stripped out the rest of the armv5 support, and this hack was just to ensure that __get_tls in libc.a went via the kernel if necessary. This patch also finishes the job of breaking up the pthread.c monolith, and adds a handful of new tests. Change-Id: Idc0ae7f5d8aa65989598acd4c01a874fe21582c7