History log of /bionic/libc/bionic/pthread_detach.cpp
Revision Date Author Comments
673b15e4ee2c6d99b150aedddc0f389e29f98e1b 19-Mar-2015 Yabin Cui <yabinc@google.com> Let g_thread_list_lock only protect g_thread_list.

As glibc/netbsd don't protect access to thread struct members by a global
lock, we don't want to do it either. This change reduces the
responsibility of g_thread_list_lock to only protect g_thread_list.

Bug: 19636317
Change-Id: I897890710653dac165d8fa4452c7ecf74abdbf2b
bbb0432a33787f1a627abb396fe343a7943ac7bc 19-Mar-2015 Yabin Cui <yabinc@google.com> Return EINVAL when calling pthread_detach for joined thread.

Change-Id: I717015132187e087e0ad485284a13c8801e25e77
aec2bb5ec67637ec4b5374287e9bc0d572632054 20-Mar-2015 Yabin Cui <yabinc@google.com> Fix two errors in pthread_detach.cpp.

The errors are introduced in "Make pthread join_state not protected by g_thread_list_lock".

Bug: 19636317
Change-Id: I58ae9711da94bfbac809abfd81311eeb70301a4b
ecbfb25c504b7360d250c849ab47890ad54b6125 17-Mar-2015 Yabin Cui <yabinc@google.com> Fix build: pthread_mutex/pthread_detach.

Change-Id: I9c7b6297d3bf3ab8004d05d44cc4c95159315c9e
58cf31b50699ed9f523de38c8e943f3bbd1ced9e 07-Mar-2015 Yabin Cui <yabinc@google.com> Make pthread join_state not protected by g_thread_list_lock.

1. Move the representation of thread join_state from pthread.attr.flag
to pthread.join_state. This clarifies thread state change.
2. Use atomic operations for pthread.join_state. So we don't need to
protect it by g_thread_list_lock. g_thread_list_lock will be reduced
to only protect g_thread_list or even removed in further changes.

Bug: 19636317
Change-Id: I31fb143a7c69508c7287307dd3b0776993ec0f43
19e246dda6772ffc532b1762cd7870d6c3b01c12 18-Dec-2014 Yabin Cui <yabinc@google.com> Fix possible leak in pthread_detach.

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
8cf1b305670123aed7638d984ca39bfd22388440 04-Dec-2014 Yabin Cui <yabinc@google.com> Use mmap to create the pthread_internal_t

Add name to mmaped regions.
Add pthread benchmark code.
Allocate pthread_internal_t on regular stack.

Bug: 16847284
Change-Id: Id60835163bb0d68092241f1a118015b5a8f85069
04620a3cd7bdea0d1b421c8772ba3f06839bbe9c 08-Mar-2014 Elliott Hughes <enh@google.com> Fix pthread_detach for already-exited threads.

Change-Id: I2bf7f41234d93b226132a4c51705f4186f4961c3
Reported-by: Paresh Nakhe <pnakhe@codeaurora.org>
0f020d18b138e24b1fe34074808e07ac412f35a4 06-Jun-2013 msg555 <msg555@gmail.com> Handles spurious wake-ups in pthread_join()

Removed 'join_count' from pthread_internal_t and switched to using the flag
PTHREAD_ATTR_FLAG_JOINED to indicate if a thread is being joined. Combined with
a switch to a while loop in pthread_join, this fixes spurious wake-ups but
prevents a thread from being joined multiple times. This is fine for
two reasons:

1) The pthread_join specification allows for undefined behavior when multiple
threads try to join a single thread.

2) There is no thread safe way to allow multiple threads to join a single
thread with the pthread interface. The second thread calling pthread_join
could be pre-empted until the thread is destroyed and its handle reused for
a different thread. Therefore multi-join is always an error.

Bug: https://code.google.com/p/android/issues/detail?id=52255
Change-Id: I8b6784d47620ffdcdbfb14524e7402e21d46c5f7
9d23e04c43dbb8480bea8be28b8a2f37423bec49 16-Feb-2013 Elliott Hughes <enh@google.com> Fix pthreads functions that should return ESRCH.

imgtec pointed out that pthread_kill(3) was broken, but most of the
other functions that ought to return ESRCH for invalid/exited threads
were equally broken.

Change-Id: I96347f6195549aee0c72dc39063e6c5d06d2e01f