1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH SET_TID_ADDRESS 2 2014-07-08 "Linux" "Linux Programmer's Manual"
27 set_tid_address \- set pointer to thread ID
30 .B #include <linux/unistd.h>
32 .BI "long set_tid_address(int *" tidptr );
35 For each thread, the kernel maintains two attributes (addresses) called
39 These two attributes contain the value NULL by default.
42 If a thread is started using
48 is set to the value passed in the
50 argument of that system call.
54 is set, the very first thing the new thread does
55 is to write its thread ID at this address.
58 If a thread is started using
61 .B CLONE_CHILD_CLEARTID
64 is set to the value passed in the
66 argument of that system call.
69 .BR set_tid_address ()
72 value for the calling thread to
77 is not NULL terminates, then,
78 if the thread is sharing memory with other threads,
79 then 0 is written at the address specified in
81 and the kernel performs the following operation:
83 futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);
85 The effect of this operation is to wake a single thread that
86 is performing a futex wait on the memory location.
87 Errors from the futex wake operation are ignored.
89 .BR set_tid_address ()
90 always returns the caller's thread ID.
92 .BR set_tid_address ()
95 This call is present since Linux 2.5.48.
96 Details as given here are valid since Linux 2.5.49.
98 This system call is Linux-specific.