File: ACE_Thread.3

package info (click to toggle)
ace 5.2.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 26,856 kB
  • ctags: 18,677
  • sloc: cpp: 171,831; makefile: 48,840; sh: 10,192; perl: 8,582; exp: 787; yacc: 387; lex: 140; csh: 20
file content (247 lines) | stat: -rw-r--r-- 11,467 bytes parent folder | download
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
.TH ACE_Thread 3 "1 Dec 2001" "ACE" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ACE_Thread \- Provides a wrapper for threads. 
.SH SYNOPSIS
.br
.PP
\fC#include <Thread.h>\fR
.PP
.SS Static Public Methods

.in +1c
.ti -1c
.RI "int \fBspawn\fR (ACE_THR_FUNC func, void *arg = 0, long flags = THR_NEW_LWP | THR_JOINABLE, \fBACE_thread_t\fR *t_id = 0, \fBACE_hthread_t\fR *t_handle = 0, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack = 0, size_t stack_size = 0, \fBACE_Thread_Adapter\fR *thread_adapter = 0)"
.br
.ti -1c
.RI "int \fBspawn_n\fR (size_t n, ACE_THR_FUNC func, void *arg = 0, long flags = THR_NEW_LWP | THR_JOINABLE, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack[] = 0, size_t stack_size[] = 0, \fBACE_Thread_Adapter\fR *thread_adapter = 0)"
.br
.ti -1c
.RI "int \fBspawn_n\fR (\fBACE_thread_t\fR thread_ids[], size_t n, ACE_THR_FUNC func, void *arg, long flags, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack[] = 0, size_t stack_size[] = 0, \fBACE_hthread_t\fR thread_handles[] = 0, \fBACE_Thread_Adapter\fR *thread_adapter = 0)"
.br
.ti -1c
.RI "int \fBjoin\fR (\fBACE_thread_t\fR, \fBACE_thread_t\fR *, void **status)"
.br
.RI "\fIWait for one or more threads to exit.\fR"
.ti -1c
.RI "int \fBjoin\fR (\fBACE_hthread_t\fR, void ** = 0)"
.br
.RI "\fIWait for one thread to exit.\fR"
.ti -1c
.RI "int \fBresume\fR (\fBACE_hthread_t\fR)"
.br
.RI "\fIContinue the execution of a previously suspended thread.\fR"
.ti -1c
.RI "int \fBsuspend\fR (\fBACE_hthread_t\fR)"
.br
.RI "\fISuspend the execution of a particular thread.\fR"
.ti -1c
.RI "int \fBgetprio\fR (\fBACE_hthread_t\fR, int &prio)"
.br
.RI "\fIGet the priority of a particular thread.\fR"
.ti -1c
.RI "int \fBsetprio\fR (\fBACE_hthread_t\fR, int prio)"
.br
.RI "\fISet the priority of a particular thread.\fR"
.ti -1c
.RI "int \fBkill\fR (\fBACE_thread_t\fR, int signum)"
.br
.RI "\fISend a signal to the thread.\fR"
.ti -1c
.RI "void \fByield\fR (void)"
.br
.RI "\fIYield the thread to another.\fR"
.ti -1c
.RI "void \fBself\fR (\fBACE_hthread_t\fR &t_handle)"
.br
.ti -1c
.RI "\fBACE_thread_t\fR \fBself\fR (void)"
.br
.RI "\fIReturn the unique ID of the thread.\fR"
.ti -1c
.RI "void \fBexit\fR (void *status = 0)"
.br
.RI "\fIExit the current thread and return "status". Should _not_ be called by main thread.\fR"
.ti -1c
.RI "int \fBgetconcurrency\fR (void)"
.br
.RI "\fIGet the LWP concurrency level of the process.\fR"
.ti -1c
.RI "int \fBsetconcurrency\fR (int new_level)"
.br
.RI "\fISet the LWP concurrency level of the process.\fR"
.ti -1c
.RI "int \fBsigsetmask\fR (int how, const sigset_t *sigset, sigset_t *osigset = 0)"
.br
.RI "\fIChange and/or examine calling thread's signal mask.\fR"
.ti -1c
.RI "int \fBkeycreate\fR (\fBACE_thread_key_t\fR *keyp, \fBACE_THR_DEST\fR destructor, void * = 0)"
.br
.ti -1c
.RI "int \fBkeyfree\fR (\fBACE_thread_key_t\fR key)"
.br
.RI "\fIFree up the key so that other threads can reuse it.\fR"
.ti -1c
.RI "int \fBsetspecific\fR (\fBACE_thread_key_t\fR key, void *value)"
.br
.RI "\fIBind value to the thread-specific data key, <key>, for the calling thread.\fR"
.ti -1c
.RI "int \fBgetspecific\fR (\fBACE_thread_key_t\fR key, void **valuep)"
.br
.RI "\fIStores the current value bound to <key> for the calling thread into the location pointed to by <valuep>.\fR"
.ti -1c
.RI "int \fBdisablecancel\fR (struct \fBcancel_state\fR *old_state)"
.br
.RI "\fIDisable thread cancellation.\fR"
.ti -1c
.RI "int \fBenablecancel\fR (struct \fBcancel_state\fR *old_state, int flag)"
.br
.RI "\fIEnable thread cancellation.\fR"
.ti -1c
.RI "int \fBsetcancelstate\fR (struct \fBcancel_state\fR &new_state, struct \fBcancel_state\fR *old_state)"
.br
.RI "\fISet the cancellation state.\fR"
.ti -1c
.RI "int \fBcancel\fR (\fBACE_thread_t\fR t_id)"
.br
.ti -1c
.RI "void \fBtestcancel\fR (void)"
.br
.RI "\fITest the cancel.\fR"
.in -1c
.SS Private Methods

.in +1c
.ti -1c
.RI "\fBACE_Thread\fR (void)"
.br
.RI "\fIEnsure that we don't get instantiated.\fR"
.in -1c
.SH DETAILED DESCRIPTION
.PP 
Provides a wrapper for threads.
.PP
.PP
 This class provides a common interface that is mapped onto POSIX Pthreads, Solaris threads, Win32 threads, VxWorks threads, or pSoS threads. Note, however, that it is generally a better idea to use the  programming API rather than the  API since the thread manager is more powerful. 
.PP
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP 
.SS ACE_Thread::ACE_Thread (void)\fC [private]\fR
.PP
Ensure that we don't get instantiated.
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.PP 
.SS int ACE_Thread::cancel (\fBACE_thread_t\fR t_id)\fC [static]\fR
.PP
Cancel a thread. Note that this method is only portable on platforms, such as POSIX pthreads, that support thread cancellation. 
.SS int ACE_Thread::disablecancel (struct \fBcancel_state\fR * old_state)\fC [static]\fR
.PP
Disable thread cancellation.
.PP
.SS int ACE_Thread::enablecancel (struct \fBcancel_state\fR * old_state, int flag)\fC [static]\fR
.PP
Enable thread cancellation.
.PP
.SS void ACE_Thread::exit (void * status = 0)\fC [static]\fR
.PP
Exit the current thread and return "status". Should _not_ be called by main thread.
.PP
.SS int ACE_Thread::getconcurrency (void)\fC [static]\fR
.PP
Get the LWP concurrency level of the process.
.PP
.SS int ACE_Thread::getprio (\fBACE_hthread_t\fR, int & prio)\fC [static]\fR
.PP
Get the priority of a particular thread.
.PP
.SS int ACE_Thread::getspecific (\fBACE_thread_key_t\fR key, void ** valuep)\fC [static]\fR
.PP
Stores the current value bound to <key> for the calling thread into the location pointed to by <valuep>.
.PP
.SS int ACE_Thread::join (\fBACE_hthread_t\fR, void ** = 0)\fC [static]\fR
.PP
Wait for one thread to exit.
.PP
.SS int ACE_Thread::join (\fBACE_thread_t\fR, \fBACE_thread_t\fR *, void ** status)\fC [static]\fR
.PP
Wait for one or more threads to exit.
.PP
.SS int ACE_Thread::keycreate (\fBACE_thread_key_t\fR * keyp, \fBACE_THR_DEST\fR destructor, void * = 0)\fC [static]\fR
.PP
.SS int ACE_Thread::keyfree (\fBACE_thread_key_t\fR key)\fC [static]\fR
.PP
Free up the key so that other threads can reuse it.
.PP
.SS int ACE_Thread::kill (\fBACE_thread_t\fR, int signum)\fC [static]\fR
.PP
Send a signal to the thread.
.PP
.SS int ACE_Thread::resume (\fBACE_hthread_t\fR)\fC [static]\fR
.PP
Continue the execution of a previously suspended thread.
.PP
.SS \fBACE_thread_t\fR ACE_Thread::self (void)\fC [static]\fR
.PP
Return the unique ID of the thread.
.PP
.SS void ACE_Thread::self (\fBACE_hthread_t\fR & t_handle)\fC [static]\fR
.PP
Return the unique kernel handle of the thread. Note that on Win32 this is actually a pseudohandle, which cannot be shared with other processes or waited on by threads. To locate the real handle, please use the  method. 
.SS int ACE_Thread::setcancelstate (struct \fBcancel_state\fR & new_state, struct \fBcancel_state\fR * old_state)\fC [static]\fR
.PP
Set the cancellation state.
.PP
.SS int ACE_Thread::setconcurrency (int new_level)\fC [static]\fR
.PP
Set the LWP concurrency level of the process.
.PP
.SS int ACE_Thread::setprio (\fBACE_hthread_t\fR, int prio)\fC [static]\fR
.PP
Set the priority of a particular thread.
.PP
.SS int ACE_Thread::setspecific (\fBACE_thread_key_t\fR key, void * value)\fC [static]\fR
.PP
Bind value to the thread-specific data key, <key>, for the calling thread.
.PP
.SS int ACE_Thread::sigsetmask (int how, const sigset_t * sigset, sigset_t * osigset = 0)\fC [static]\fR
.PP
Change and/or examine calling thread's signal mask.
.PP
.SS int ACE_Thread::spawn (ACE_THR_FUNC func, void * arg = 0, long flags = THR_NEW_LWP | THR_JOINABLE, \fBACE_thread_t\fR * t_id = 0, \fBACE_hthread_t\fR * t_handle = 0, long priority = ACE_DEFAULT_THREAD_PRIORITY, void * stack = 0, size_t stack_size = 0, \fBACE_Thread_Adapter\fR * thread_adapter = 0)\fC [static]\fR
.PP
Creates a new thread having <flags> attributes and running <func> with  (if <thread_adapter> is non-0 then <func> and  are ignored and are obtained from <thread_adapter>). <thr_id> and <t_handle> are set to the thread's ID and handle (?), respectively. The thread runs at <priority> priority (see below).
.PP
The <flags> are a bitwise-OR of the following: = BEGIN<INDENT> THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED, THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED, THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO, THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED, THR_SCOPE_SYSTEM, THR_SCOPE_PROCESS = END<INDENT>
.PP
By default, or if <priority> is set to ACE_DEFAULT_THREAD_PRIORITY, an "appropriate" priority value for the given scheduling policy (specified in <flags}>, e.g., <THR_SCHED_DEFAULT>) is used. This value is calculated dynamically, and is the median value between the minimum and maximum priority values for the given policy. If an explicit value is given, it is used. Note that actual priority values are EXTREMEMLY implementation-dependent, and are probably best avoided.
.PP
Note that <thread_adapter> is always deleted by <thr_create>, therefore it must be allocated with global operator new. 
.SS int ACE_Thread::spawn_n (\fBACE_thread_t\fR thread_ids[], size_t n, ACE_THR_FUNC func, void * arg, long flags, long priority = ACE_DEFAULT_THREAD_PRIORITY, void * stack[] = 0, size_t stack_size[] = 0, \fBACE_hthread_t\fR thread_handles[] = 0, \fBACE_Thread_Adapter\fR * thread_adapter = 0)\fC [static]\fR
.PP
Spawn <n> new threads, which execute <func> with argument  (if <thread_adapter> is non-0 then <func> and  are ignored and are obtained from <thread_adapter>). The thread_ids of successfully spawned threads will be placed into the <thread_ids> buffer (which must be the same size as <n>). If <stack> != 0 it is assumed to be an array of <n> pointers to the base of the stacks to use for the threads being spawned. If <stack_size> != 0 it is assumed to be an array of <n> values indicating how big each of the corresponding <stack>s are. If <thread_handles> != 0 it is assumed to be an array of <n> thread_handles that will be assigned the values of the thread handles being spawned. Returns the number of threads actually spawned (if this doesn't equal the number requested then something has gone wrong and <errno> will explain...).
.PP
See also <spawn>. 
.SS int ACE_Thread::spawn_n (size_t n, ACE_THR_FUNC func, void * arg = 0, long flags = THR_NEW_LWP | THR_JOINABLE, long priority = ACE_DEFAULT_THREAD_PRIORITY, void * stack[] = 0, size_t stack_size[] = 0, \fBACE_Thread_Adapter\fR * thread_adapter = 0)\fC [static]\fR
.PP
Spawn N new threads, which execute <func> with argument  (if <thread_adapter> is non-0 then <func> and  are ignored and are obtained from <thread_adapter>). If <stack> != 0 it is assumed to be an array of <n> pointers to the base of the stacks to use for the threads being spawned. Likewise, if <stack_size> != 0 it is assumed to be an array of <n> values indicating how big each of the corresponding <stack>s are. Returns the number of threads actually spawned (if this doesn't equal the number requested then something has gone wrong and <errno> will explain...).
.PP
See also <spawn>. 
.SS int ACE_Thread::suspend (\fBACE_hthread_t\fR)\fC [static]\fR
.PP
Suspend the execution of a particular thread.
.PP
.SS void ACE_Thread::testcancel (void)\fC [static]\fR
.PP
Test the cancel.
.PP
.SS void ACE_Thread::yield (void)\fC [static]\fR
.PP
Yield the thread to another.
.PP


.SH AUTHOR
.PP 
Generated automatically by Doxygen for ACE from the source code.