The clone() script can accept the CLONE_CHILD_CLEARTID flag, which is cleared of the value of child_tidptr (another clone() argument), and the associated futex signal wakes up when the child stream exits. This is used to implement pthread_join() (the parent thread is expecting futex).
set_tid_address() allows pthread_join() in the source thread. Additional information in the following LKML threads:
fix fix fix, tid-2.5.47-A3
[patch] user-vm-unlock-2.5.31-A2
As for why some programs call set_tid_address() and others not, the answer is simple. Programs related (directly or indirectly) to the libpthread set_tid_address . ls is associated with librt , which is associated with libpthread , so it starts initialization for NPTL.
ninjalj
source share