forked from GerHobbelt/pthread-win32
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pthread_setname_np.html
228 lines (228 loc) · 7.62 KB
/
pthread_setname_np.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>PTHREAD_SETNAME_NP(3) manual page</TITLE>
<STYLE TYPE="text/css">
<!--
P { margin-bottom: 0.21cm }
TD P { margin-bottom: 0.21cm }
PRE.western { font-family: "Times New Roman", serif }
PRE.cjk { font-family: "NSimSun", monospace }
H4 { margin-bottom: 0.21cm }
H4.western { font-family: "Arial", sans-serif; font-size: 11pt; font-style: italic }
H4.cjk { font-family: "Microsoft YaHei"; font-size: 11pt; font-style: italic }
H4.ctl { font-family: "Mangal"; font-size: 11pt; font-style: italic }
H2 { margin-bottom: 0.21cm }
H2.cjk { font-family: "SimSun" }
H2.ctl { font-family: "Mangal" }
P.list-indent { margin-left: 5cm; text-indent: -4.5cm }
A:link { so-language: zxx }
-->
</STYLE>
</HEAD>
<BODY LANG="en-AU" DIR="LTR">
<H4 CLASS="western"><SPAN STYLE="font-variant: normal"><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-style: normal">POSIX
Threads for Windows – REFERENCE - <A HREF="http://sourceforge.net/projects/pthreads4w/">pthreads-win32</A></SPAN></FONT></FONT></SPAN></H4>
<P><A HREF="index.html">Reference Index</A></P>
<P><A HREF="#toc" NAME="sect">Table of Contents</A></P>
<H2 CLASS="western"><A HREF="#toc0" NAME="sect0">Name</A></H2>
<P>pthread_getname_np, pthread_setname_np - get and set the thread
name</P>
<H2 CLASS="western"><A HREF="#toc1" NAME="sect1"><SPAN STYLE="text-decoration: none">Synopsis</SPAN></A></H2>
<P><B>#include <pthread.h> </B>
</P>
<P><B>int pthread_getname_np(pthread_t </B><I><SPAN STYLE="font-weight: normal">thr</SPAN></I><B>,
char * </B><I><SPAN STYLE="font-weight: normal">name</SPAN></I><B>,
int </B><I><SPAN STYLE="font-weight: normal">len</SPAN></I><B>);</B></P>
<P>#if defined (PTW32_COMPATIBILITY_BSD) ||
defined (PTW32_COMPATIBILITY_TRU64)<BR><B>int
pthread_setname_np(pthread_t </B><I><SPAN STYLE="font-weight: normal">thr</SPAN></I><B>,
const char * </B><I><SPAN STYLE="font-weight: normal">name</SPAN></I><B>,
void * </B><I><SPAN STYLE="font-weight: normal">arg</SPAN></I><B>);</B></P>
<P>#else</P>
<P><B>int pthread_setname_np(pthread_t </B><I><SPAN STYLE="font-weight: normal">thr</SPAN></I><B>,
const char * </B><I><SPAN STYLE="font-weight: normal">name</SPAN></I><B>);</B></P>
<P>#endif</P>
<H2 CLASS="western"><A HREF="#toc2" NAME="sect2">Description</A></H2>
<P><B>pthread_setname_np()</B> sets the descriptive name of the
thread. It takes the following arguments.</P>
<P>#if defined (PTW32_COMPATIBILITY_BSD)</P>
<TABLE WIDTH=100% CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=30*>
<COL WIDTH=226*>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>thr</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The thread whose name will be set.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>name</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The printf(3) format string to be used to construct the name of
the thread. The resulting name should be shorter than
<B>PTHREAD_MAX_NAMELEN_NP</B>.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>arg</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The printf(3) argument used with name.</P>
</TD>
</TR>
</TABLE>
<P>#elif defined (PTW32_COMPATIBILITY_TRU64)</P>
<TABLE WIDTH=100% CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=30*>
<COL WIDTH=226*>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>thr</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The thread whose name will be set.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>name</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The name.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>arg</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>Reserved for future use.</P>
</TD>
</TR>
</TABLE>
<P>#else</P>
<TABLE WIDTH=100% CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=30*>
<COL WIDTH=226*>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>thr</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The thread whose name will be set.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>name</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The name.</P>
</TD>
</TR>
</TABLE>
<P>#endif</P>
<P>The string passed as the name argument is copied.</P>
<P><BR><BR>
</P>
<P><B>pthread_getname_np()</B> gets the descriptive name of the
thread. It takes the following arguments.</P>
<TABLE WIDTH=100% CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=30*>
<COL WIDTH=226*>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>thr</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The thread whose descriptive name will be obtained.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>name</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The buffer to be filled with the descriptive name of the
thread.</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=12% STYLE="border: none; padding: 0cm">
<P><I>len</I></P>
</TD>
<TD WIDTH=88% STYLE="border: none; padding: 0cm">
<P>The size of the buffer name in bytes.</P>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<P>For the MSVC built library the name is made available for use and
display by the MSVS debugger.</P>
<H2 CLASS="western"><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
<P>These routines return 0 on success or an error code on failure.</P>
<PRE CLASS="western" STYLE="margin-bottom: 0.5cm"> </PRE><H2 CLASS="western">
<A HREF="#toc4" NAME="sect4">Errors</A></H2>
<P>The pthread_setname_np function shall fail if:
</P>
<DL>
<DT STYLE="margin-bottom: 0.5cm"><B>ESRCH</B>
</DT></DL>
<P CLASS="list-indent">
The value specified by thr does not refer to a valid thread.</P>
<DL>
<DT STYLE="margin-bottom: 0.5cm"><B>EINVAL</B></DT></DL>
<P CLASS="list-indent">
The expansion of name with arg has length greater or equal to
<B>PTHREAD_MAX_NAMELEN_NP</B>.</P>
<P><BR><BR>
</P>
<P><I>The following sections are informative. </I>
</P>
<H2 CLASS="western"><A HREF="#toc5" NAME="sect5">Examples</A></H2>
<P>None.
</P>
<H2 CLASS="western"><A HREF="#toc6" NAME="sect6">Application Usage</A></H2>
<P>In addition to use within applications, when the library is built
with MSVC, thread names set via pthread_setname_np will be available
for display in the MSVS debugger.</P>
<H2 CLASS="western"><A HREF="#toc7" NAME="sect7">Rationale</A></H2>
<P>None.
</P>
<H2 CLASS="western"><A HREF="#toc8" NAME="sect8">Future Directions</A></H2>
<P>None.
</P>
<H2 CLASS="western"><A HREF="#toc9" NAME="sect9">See Also</A></H2>
<P>The Base Definitions volume of IEEE Std 1003.1-2001,
<pthread.h>
</P>
<H2 CLASS="western"><A HREF="#sect" NAME="toc">Table of Contents</A></H2>
<P><A HREF="#sect0" NAME="toc0">Name</A>
</P>
<P><A HREF="#sect1" NAME="toc1">Synopsis</A>
</P>
<P><A HREF="#sect2" NAME="toc2">Description</A>
</P>
<P><A HREF="#sect3" NAME="toc3">Return Value</A>
</P>
<P><A HREF="#sect4" NAME="toc4">Errors</A>
</P>
<P><A HREF="#sect5" NAME="toc5">Examples</A>
</P>
<P><A HREF="#sect6" NAME="toc6">Application Usage</A>
</P>
<P><A HREF="#sect7" NAME="toc7">Rationale</A>
</P>
<P><A HREF="#sect8" NAME="toc8">Future Directions</A>
</P>
<P><A HREF="#sect9" NAME="toc9">See Also</A></P>
</BODY>
</HTML>