View | Details | Raw Unified | Return to bug 75581
Collapse All | Expand All

(-)./pthread_attr_setcreatesuspend_np.3 (-1 / +1 lines)
Lines 29-35 Link Here
29
.Os
29
.Os
30
.Sh NAME
30
.Sh NAME
31
.Nm pthread_attr_setcreatesuspend_np
31
.Nm pthread_attr_setcreatesuspend_np
32
.Nd prepare attribute for creattion of suspended thread
32
.Nd prepare attribute for creation of suspended thread
33
.Sh LIBRARY
33
.Sh LIBRARY
34
.Lb libc_r
34
.Lb libc_r
35
.Sh SYNOPSIS
35
.Sh SYNOPSIS
(-)./pthread_cancel.3 (-1 / +1 lines)
Lines 17-23 Link Here
17
function requests that
17
function requests that
18
.Fa thread
18
.Fa thread
19
be canceled.
19
be canceled.
20
The target thread's cancelability state and type determines
20
The target thread's cancellability state and type determines
21
when the cancellation takes effect.
21
when the cancellation takes effect.
22
When the cancellation is acted on,
22
When the cancellation is acted on,
23
the cancellation cleanup handlers for
23
the cancellation cleanup handlers for
(-)./pthread_once.3 (-1 / +2 lines)
Lines 76-82 Link Here
76
However, if
76
However, if
77
.Fn init_routine
77
.Fn init_routine
78
is a cancellation point and is cancelled, the effect on
78
is a cancellation point and is cancelled, the effect on
79
.Fa once_control is as if
79
.Fa once_control
80
is as if
80
.Fn pthread_once
81
.Fn pthread_once
81
was never called.
82
was never called.
82
.Pp
83
.Pp
(-)./pthread_setspecific.3 (-1 / +1 lines)
Lines 49-55 Link Here
49
.Fa key
49
.Fa key
50
obtained via a previous call to
50
obtained via a previous call to
51
.Fn pthread_key_create .
51
.Fn pthread_key_create .
52
Different threads man bind different values to the same key.
52
Different threads can bind different values to the same key.
53
These values are
53
These values are
54
typically pointers to blocks of dynamically allocated memory that have been
54
typically pointers to blocks of dynamically allocated memory that have been
55
reserved for use by the calling thread.
55
reserved for use by the calling thread.
(-)./pthread_testcancel.3 (-22 / +24 lines)
Lines 6-12 Link Here
6
.Nm pthread_setcancelstate ,
6
.Nm pthread_setcancelstate ,
7
.Nm pthread_setcanceltype ,
7
.Nm pthread_setcanceltype ,
8
.Nm pthread_testcancel
8
.Nm pthread_testcancel
9
.Nd set cancelability state
9
.Nd set cancellability state
10
.Sh LIBRARY
10
.Sh LIBRARY
11
.Lb libc_r
11
.Lb libc_r
12
.Sh SYNOPSIS
12
.Sh SYNOPSIS
Lines 20-33 Link Here
20
.Sh DESCRIPTION
20
.Sh DESCRIPTION
21
The
21
The
22
.Fn pthread_setcancelstate
22
.Fn pthread_setcancelstate
23
function atomically both sets the calling thread's cancelability state
23
function atomically both sets the calling thread's cancellability state
24
to the indicated
24
to the indicated
25
.Fa state
25
.Fa state
26
and, if
26
and, if
27
.Fa oldstate
27
.Fa oldstate
28
is not
28
is not
29
.Dv NULL ,
29
.Dv NULL ,
30
returns the previous cancelability state at the location referenced by
30
returns the previous cancellability state at the location referenced by
31
.Fa oldstate .
31
.Fa oldstate .
32
Legal values for
32
Legal values for
33
.Fa state
33
.Fa state
Lines 38-51 Link Here
38
.Pp
38
.Pp
39
The
39
The
40
.Fn pthread_setcanceltype
40
.Fn pthread_setcanceltype
41
function atomically both sets the calling thread's cancelability type
41
function atomically both sets the calling thread's cancellability type
42
to the indicated
42
to the indicated
43
.Fa type
43
.Fa type
44
and, if
44
and, if
45
.Fa oldtype
45
.Fa oldtype
46
is not
46
is not
47
.Dv NULL ,
47
.Dv NULL ,
48
returns the previous cancelability type at the location referenced by
48
returns the previous cancellability type at the location referenced by
49
.Fa oldtype .
49
.Fa oldtype .
50
Legal values for
50
Legal values for
51
.Fa type
51
.Fa type
Lines 54-60 Link Here
54
and
54
and
55
.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
55
.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
56
.Pp
56
.Pp
57
The cancelability state and type of any newly created threads, including the
57
The cancellability state and type of any newly created threads, including the
58
thread in which
58
thread in which
59
.Fn main
59
.Fn main
60
was first invoked, are
60
was first invoked, are
Lines 68-100 Link Here
68
function creates a cancellation point in the calling thread.
68
function creates a cancellation point in the calling thread.
69
The
69
The
70
.Fn pthread_testcancel
70
.Fn pthread_testcancel
71
function has no effect if cancelability is disabled.
71
function has no effect if cancellability is disabled.
72
.Pp
72
.Pp
73
.Ss Cancelability States
73
.Ss Cancelability States
74
The cancelability state of a thread determines the action taken upon
74
The cancellability state of a thread determines the action taken upon
75
receipt of a cancellation request.
75
receipt of a cancellation request.
76
The thread may control cancellation in
76
The thread may control cancellation in
77
a number of ways.
77
a number of ways.
78
.Pp
78
.Pp
79
Each thread maintains its own
79
Each thread maintains its own
80
.Dq cancelability state
80
.Dq cancellability state
81
which may be encoded in two bits:
81
which may be encoded in two bits:
82
.Bl -hang
82
.Bl -hang
83
.It Em Cancelability Enable
83
.It Em Cancelability Enable
84
When cancelability is
84
.br
85
When cancellability is
85
.Dv PTHREAD_CANCEL_DISABLE ,
86
.Dv PTHREAD_CANCEL_DISABLE ,
86
cancellation requests against the target thread are held pending.
87
cancellation requests against the target thread are held pending.
87
.It Em Cancelability Type
88
.It Em Cancelability Type
88
When cancelability is enabled and the cancelability type is
89
.br
90
When cancellability is enabled and the cancellability type is
89
.Dv PTHREAD_CANCEL_ASYNCHRONOUS ,
91
.Dv PTHREAD_CANCEL_ASYNCHRONOUS ,
90
new or pending cancellation requests may be acted upon at any time.
92
new or pending cancellation requests may be acted upon at any time.
91
When cancelability is enabled and the cancelability type is
93
When cancellability is enabled and the cancellability type is
92
.Dv PTHREAD_CANCEL_DEFERRED ,
94
.Dv PTHREAD_CANCEL_DEFERRED ,
93
cancellation requests are held pending until a cancellation point (see
95
cancellation requests are held pending until a cancellation point (see
94
below) is reached.
96
below) is reached.
95
If cancelability is disabled, the setting of the
97
If cancellability is disabled, the setting of the
96
cancelability type has no immediate effect as all cancellation requests
98
cancellability type has no immediate effect as all cancellation requests
97
are held pending; however, once cancelability is enabled again the new
99
are held pending; however, once cancellability is enabled again the new
98
type will be in effect.
100
type will be in effect.
99
.El
101
.El
100
.Ss Cancellation Points
102
.Ss Cancellation Points
Lines 147-173 Link Here
147
Objects may depend
149
Objects may depend
148
on other objects.
150
on other objects.
149
.Pp
151
.Pp
150
First, cancelability should only be disabled on entry to an object, never
152
First, cancellability should only be disabled on entry to an object, never
151
explicitly enabled.
153
explicitly enabled.
152
On exit from an object, the cancelability state should
154
On exit from an object, the cancellability state should
153
always be restored to its value on entry to the object.
155
always be restored to its value on entry to the object.
154
.Pp
156
.Pp
155
This follows from a modularity argument: if the client of an object (or the
157
This follows from a modularity argument: if the client of an object (or the
156
client of an object that uses that object) has disabled cancelability, it is
158
client of an object that uses that object) has disabled cancellability, it is
157
because the client doesn't want to have to worry about how to clean up if the
159
because the client doesn't want to have to worry about how to clean up if the
158
thread is canceled while executing some sequence of actions.
160
thread is canceled while executing some sequence of actions.
159
If an object
161
If an object
160
is called in such a state and it enables cancelability and a cancellation
162
is called in such a state and it enables cancellability and a cancellation
161
request is pending for that thread, then the thread will be canceled,
163
request is pending for that thread, then the thread will be canceled,
162
contrary to the wish of the client that disabled.
164
contrary to the wish of the client that disabled.
163
.Pp
165
.Pp
164
Second, the cancelability type may be explicitly set to either
166
Second, the cancellability type may be explicitly set to either
165
.Em deferred
167
.Em deferred
166
or
168
or
167
.Em asynchronous
169
.Em asynchronous
168
upon entry to an object.
170
upon entry to an object.
169
But as with the cancelability state, on exit from
171
But as with the cancellability state, on exit from
170
an object that cancelability type should always be restored to its value on
172
an object that cancellability type should always be restored to its value on
171
entry to the object.
173
entry to the object.
172
.Pp
174
.Pp
173
Finally, only functions that are cancel-safe may be called from a thread that
175
Finally, only functions that are cancel-safe may be called from a thread that
(-)./queue.3 (-1 / +1 lines)
Lines 638-644 Link Here
638
.Pp
638
.Pp
639
The macro
639
The macro
640
.Nm LIST_EMPTY
640
.Nm LIST_EMPTY
641
evaluates to true if their are no elements in the list.
641
evaluates to true if there are no elements in the list.
642
.Pp
642
.Pp
643
The macro
643
The macro
644
.Nm LIST_ENTRY
644
.Nm LIST_ENTRY
(-)./rand48.3 (-1 / +1 lines)
Lines 73-79 Link Here
73
return values of type double.
73
return values of type double.
74
The full 48 bits of r(n+1) are
74
The full 48 bits of r(n+1) are
75
loaded into the mantissa of the returned value, with the exponent set
75
loaded into the mantissa of the returned value, with the exponent set
76
such that the values produced lie in the interval [0.0, 1.0).
76
such that the values produced lie in the interval [0.0, 1.0].
77
.Pp
77
.Pp
78
The
78
The
79
.Fn lrand48
79
.Fn lrand48

Return to bug 75581