File: Thread.html

package info (click to toggle)
libape 1.0.0-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,572 kB
  • ctags: 1,343
  • sloc: sh: 7,342; cpp: 3,418; makefile: 117
file content (531 lines) | stat: -rw-r--r-- 21,449 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<HTML><HEAD><TITLE>Thread Class</TITLE></HEAD>
<BODY bgcolor="#ffffff">

<H1>Thread Class Reference</H1>
<p>
[<A HREF="index.html">APE Index</A>] [<A HREF="hier.html">APE Hierarchy</A>]
[<A HREF="header-list.html">Headers</A>]
</p>
<HR>
<P>base class used to derive all APE threads of execution.   <a href="#short">More...</a></P>
<P>
<code>
	#include &lt;<a href="thread-h.html">thread.h</a>&gt;
</code>

</P>

<H2>Public Members</H2>
<UL>
<LI> <b><a href="#ref0">Thread</a></b> (bool flag) 
</LI>
<LI> <b><a href="#ref1">Thread</a></b> (Semaphore *start = NULL, int pri = 0, size_t stack = 0) 
</LI>
<LI> <b><a href="#ref2">Thread</a></b> (const Thread &amp;th) 
</LI>
<LI>virtual <b><a href="#ref3">~Thread</a></b> () 
</LI>
<LI>int <b><a href="#ref4">Start</a></b> (Semaphore *start = NULL) 
</LI>
<LI>inline Thread* <b><a href="#ref5">getParent</a></b> (void) 
</LI>
<LI>inline void <b><a href="#ref6">SignalThread</a></b> (int signo) 
</LI>
<LI>inline void <b><a href="#ref7">Suspend</a></b> (void) 
</LI>
<LI>inline void <b><a name="ref8">Suspend</a></b> (void) 
</LI>
<LI>inline void <b><a href="#ref9">Resume</a></b> (void) 
</LI>
<LI>inline void <b><a name="ref10">Resume</a></b> (void) 
</LI>
<LI>inline int <b><a href="#ref11">getCancel</a></b> (void) 
</LI>
<LI>inline bool <b><a href="#ref12">isRunning</a></b> (void) 
</LI>
<LI>inline bool <b><a href="#ref13">isThread</a></b> (void) 
</LI>
<LI>friend void <b><a href="#ref14">ape_sleep</a></b> (timeout_t msec) 
</LI>
<LI>friend void <b><a href="#ref15">suspend</a></b> (Thread &amp;th) 
</LI>
<LI>friend void <b><a href="#ref16">resume</a></b> (Thread &amp;th) 
</LI>
<LI>friend inline void <b><a href="#ref17">operator++</a></b> (Thread &amp;th) 
</LI>
<LI>friend inline int <b><a href="#ref18">start</a></b> (Thread &amp;th, Semaphore *start) 
</LI>
<LI>friend void <b><a href="#ref19">siginstall</a></b> (int signo) 
</LI>
</UL>

<H2>Protected Members</H2>
<UL>
<LI>virtual void <b><a href="#ref20">Run</a></b> (void) 
</LI>
<LI>virtual void <b><a href="#ref21">First</a></b> (void) 
</LI>
<LI>virtual void <b><a href="#ref22">Final</a></b> (void) 
</LI>
<LI>virtual void <b><a href="#ref23">Initial</a></b> (void) 
</LI>
<LI>virtual void* <b><a href="#ref24">getExtended</a></b> (void) 
</LI>
<LI>virtual void <b><a href="#ref25">Notify</a></b> (Thread *th) 
</LI>
<LI>inline void <b><a href="#ref26">SignalParent</a></b> (signo_t signo) 
</LI>
<LI>inline void <b><a href="#ref27">SignalMain</a></b> (signo_t signo) 
</LI>
<LI>virtual void <b><a href="#ref28">OnTimer</a></b> (void) 
</LI>
<LI>virtual void <b><a href="#ref29">OnPolling</a></b> (void) 
</LI>
<LI>virtual void <b><a href="#ref30">OnSignal</a></b> (int signo) 
</LI>
<LI>inline void <b><a href="#ref31">Sleep</a></b> (timeout_t msec) 
</LI>
<LI>inline void <b><a href="#ref32">Exit</a></b> (void) 
</LI>
<LI>void <b><a href="#ref33">setTimer</a></b> (timeout_t timer) 
</LI>
<LI>timeout_t <b><a href="#ref34">getTimer</a></b> (void) 
</LI>
<LI>void <b><a href="#ref35">endTimer</a></b> (void) 
</LI>
<LI>void <b><a href="#ref36">WaitSignal</a></b> (signo_t signo) 
</LI>
<LI>void <b><a href="#ref37">Yield</a></b> (void) 
</LI>
<LI>void <b><a href="#ref38">setCancel</a></b> (int mode) 
</LI>
<LI>void <b><a href="#ref39">setSuspend</a></b> (int mode) 
</LI>
<LI>void <b><a href="#ref40">setSignal</a></b> (int signo, bool mode) 
</LI>
<LI>void <b><a href="#ref41">Terminate</a></b> (void) 
</LI>
</UL>
<HR>
<H2><a name="short">Detailed Description</a></H2>
<P>

 Every thread of execution in an APE application is created by deriving
 a unique class from the APE Thread class and by implementing the Run
 method.  The base Thread class supports encapsulation of the generic
 APE threading methods implemented on various target operating systems.  
 This includes the ability to start and stop threads in a synchronized
 and controllable manner, the ability to specify thread execution priority,
 and thread specific "system call" wrappers, such as for sleep and yield.
 A thread exception is thrown if the thread cannot be created.
 

</P><HR>
<H3><b> <a name="ref0"></a><a name="Thread">Thread</a>(bool flag)  </b><code>[public]</code></H3>
<p>This is actually a special constructor that is used to create a
thread "object" for the current execution context when that context
is not created via an instance of a derived Thread object itself.
This constructor does not support First.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
bool</td><td align="left" valign="top">
used if the main "thread" of the application.</td></tr>
</table>
</dl>
<H3><b> <a name="ref1"></a><a name="Thread">Thread</a>(<a href="Semaphore.html">Semaphore</a> *start = NULL, int pri = 0, size_t stack = 0)  </b><code>[public]</code></H3>
<p>When a thread object is contructed, a new thread of execution
context is created.  This constructor allows basic properties
of that context (thread priority, stack space, etc) to be defined.
The starting condition is also specified for whether the thread
is to wait on a semaphore before begining execution or wait until
it's start method is called.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
pri</td><td align="left" valign="top">
thread base priority relative to it's parent.</td></tr>
<tr><td align="left" valign="top">
stack</td><td align="left" valign="top">
space as needed in some implementations.</td></tr>
<tr><td align="left" valign="top">
start</td><td align="left" valign="top">
semaphore to wait before executing thread.</td></tr>
</table>
</dl>
<H3><b> <a name="ref2"></a><a name="Thread">Thread</a>(const <a href="Thread.html">Thread</a> &amp;th)  </b><code>[public]</code></H3>
<p>A thread of execution can also be specified by cloning an existing
thread.  The existing thread's properties (cancel mode, priority,
etc), are also duplicated.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
th</td><td align="left" valign="top">
currently executing thread object to clone.</td></tr>
</table>
</dl>
<H3><b> <a name="ref3"></a><a name="~Thread">~Thread</a>()  </b><code>[public virtual]</code></H3>
<p>The thread destructor should clear up any resources that have
been allocated by the thread.  The desctructor of a derived
thread should begin with Terminate() and is presumed to then
execute within the context of the thread causing terminaton.
</p>
<H3><b>int <a name="ref4"></a><a name="Start">Start</a>(<a href="Semaphore.html">Semaphore</a> *start = NULL)  </b><code>[public]</code></H3>
<p>When a new thread is created, it does not begin immediate
execution.  This is because the derived class virtual tables
are not properly loaded at the time the C++ object is created
within the constructor itself, at least in some compiler/system 
combinations.  The thread can either be told to wait for an
external semaphore, or it can be started directly after the
constructor completes by calling the Start() method.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
start</td><td align="left" valign="top">
optional starting semaphore to alternately use.</td></tr>
</table>
</dl>
<dl><dt><b>Returns</b>:<dd>
error code if execution fails.</dl>
<H3><b>inline <a href="Thread.html">Thread</a>* <a name="ref5"></a><a name="getParent">getParent</a>(void)  </b><code>[public]</code></H3>
<p>Gets the pointer to the Thread class which created the current
thread object.
</p><p>
</p>
<dl><dt><b>Returns</b>:<dd>
a Thread *, or "(Thread *)this" if no parent.</dl>
<H3><b>inline void <a name="ref6"></a><a name="SignalThread">SignalThread</a>(int signo)  </b><code>[public]</code></H3>
<p>Delivers a Posix signal to the current thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
a posix signal id.</td></tr>
</table>
</dl>
<H3><b>inline void <a name="ref7"></a><a name="Suspend">Suspend</a>(void)  </b><code>[public]</code></H3>
<p>Suspends execution of the selected thread.  Pthreads do not
normally support suspendable threads, so the behavior is
simulated with signals.  On systems such as Linux that
define threads as processes, SIGSTOP and SIGCONT may be used.
</p>
<H3><b>inline void <a name="ref9"></a><a name="Resume">Resume</a>(void)  </b><code>[public]</code></H3>
<p>Resumes execution of the selected thread.
</p>
<H3><b>inline int <a name="ref11"></a><a name="getCancel">getCancel</a>(void)  </b><code>[public]</code></H3>
<p>Used to retrieve the cancellation mode in effect for the
selected thread.
</p><p>
</p>
<dl><dt><b>Returns</b>:<dd>
cancellation mode constant.</dl>
<H3><b>inline bool <a name="ref12"></a><a name="isRunning">isRunning</a>(void)  </b><code>[public]</code></H3>
<p>Verifies if the thread is still running or has already been
terminated but not yet deleted.
</p><p>
</p>
<dl><dt><b>Returns</b>:<dd>
true if the thread is still executing.</dl>
<H3><b>inline bool <a name="ref13"></a><a name="isThread">isThread</a>(void)  </b><code>[public]</code></H3>
<p>Tests to see if the current execution context is the same as
the specified thread object.
</p><p>
</p>
<dl><dt><b>Returns</b>:<dd>
true if the current context is this object.</dl>
<H3><b>friend void <a name="ref14"></a><a name="ape_sleep">ape_sleep</a>(timeout_t msec)  </b><code>[public]</code></H3>
<p>Thread safe sleep call replacement.  This is mapped into sleep().
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
msec</td><td align="left" valign="top">
timeout in millisecond time range.</td></tr>
</table>
</dl>
<H3><b>friend void <a name="ref15"></a><a name="suspend">suspend</a>(<a href="Thread.html">Thread</a> &amp;th)  </b><code>[public]</code></H3>
<p>Suspend the execution of the specified thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
th</td><td align="left" valign="top">
specified thread.</td></tr>
</table>
</dl>
<H3><b>friend void <a name="ref16"></a><a name="resume">resume</a>(<a href="Thread.html">Thread</a> &amp;th)  </b><code>[public]</code></H3>
<p>Resume execution of the specified thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
th</td><td align="left" valign="top">
specified thread.</td></tr>
</table>
</dl>
<H3><b>friend inline void <a name="ref17"></a><a name="operator++">operator++</a>(<a href="Thread.html">Thread</a> &amp;th)  </b><code>[public]</code></H3>
<p>Signal the semaphore that the specified thread is waiting for
before beginning execution.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
th</td><td align="left" valign="top">
specified thread.</td></tr>
</table>
</dl>
<H3><b>friend inline int <a name="ref18"></a><a name="start">start</a>(<a href="Thread.html">Thread</a> &amp;th, <a href="Semaphore.html">Semaphore</a> *start)  </b><code>[public]</code></H3>
<p>Start execution of a specified thread.
</p>
<H3><b>friend void <a name="ref19"></a><a name="siginstall">siginstall</a>(int signo)  </b><code>[public]</code></H3>
<p>Install a signal handler for use by APE threads and
the OnSignal() event notification handler.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
posix signal id.</td></tr>
</table>
</dl>
<H3><b>void <a name="ref20"></a><a name="Run">Run</a>(void)  </b><code>[protected virtual]</code></H3>
<p>All APE threads execute by deriving the Run method of Thread.
This method is called after Initial to begin normal operation
of the thread.  If the method terminates, then the thread will
also terminate after notifying it's parent and calling it's
Final() method.
</p><p>
</p>
<dl><dt><b>See Also</b>:<dd><a href="Thread.html#Initial">Initial</a></dl>
<H3><b>void <a name="ref21"></a><a name="First">First</a>(void)  </b><code>[protected virtual]</code></H3>
<p>This method is called for the very first instance of a new thread
being created in a multi-threaded application.  Hence, it is only
called once, and by the derived Thread class that happens to be
created first.
</p>
<H3><b>void <a name="ref22"></a><a name="Final">Final</a>(void)  </b><code>[protected virtual]</code></H3>
<p>A thread that is self terminating, either by invoking Exit() or
leaving it's Run(), will have this method called.  It can be used
to self delete the current object assuming the object was created
with new on the heap rather than stack local, hence one may often
see Final defined as "delete this" in a derived thread class.  A
Final method, while running, cannot be terminated or cancelled by
another thread.
</p><p>
</p>
<dl><dt><b>See Also</b>:<dd><a href="Thread.html#Exit">Exit</a>, <a href="Thread.html#Run">Run</a></dl>
<H3><b>void <a name="ref23"></a><a name="Initial">Initial</a>(void)  </b><code>[protected virtual]</code></H3>
<p>The initial method is called by a newly created thread when it
starts execution.  This method is ran with deferred cancellation
disabled by default.  The Initial method is given a seperate
handler so that it can create temporary objects on it's own
stack frame, rather than having objects created on Run() that
are only needed by startup and yet continue to consume stack space.
</p><p>
</p>
<dl><dt><b>See Also</b>:<dd><a href="Thread.html#Run">Run</a></dl>
<H3><b>void* <a name="ref24"></a><a name="getExtended">getExtended</a>(void)  </b><code>[protected virtual]</code></H3>
<p>Since getParent() and getAPE() only refer to an object of the
Thread "base" type, this virtual method can be replaced in a
derived class with something that returns data specific to the
derived class that can still be accessed through the pointer
returned by getParent() and getAPE().
</p><p>
</p>
<dl><dt><b>Returns</b>:<dd>
pointer to derived class specific data.</dl>
<H3><b>void <a name="ref25"></a><a name="Notify">Notify</a>(<a href="Thread.html">Thread</a> *th)  </b><code>[protected virtual]</code></H3>
<p>When a thread terminates, it now sends a notification message
to the parent thread which created it.  The actual use of this
notification is left to be defined in a derived class.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
th</td><td align="left" valign="top">
the thread that has terminated.</td></tr>
</table>
</dl>
<H3><b>inline void <a name="ref26"></a><a name="SignalParent">SignalParent</a>(signo_t signo)  </b><code>[protected]</code></H3>
<p>In the Posix version of APE, this can be used to send a
signal into the parent thread of the current object.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
a posix signal id.</td></tr>
</table>
</dl>
<H3><b>inline void <a name="ref27"></a><a name="SignalMain">SignalMain</a>(signo_t signo)  </b><code>[protected]</code></H3>
<p>In the Posix version of APE, this can be used to send a
signal into the nain application thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
a posix signal id.</td></tr>
</table>
</dl>
<H3><b>void <a name="ref28"></a><a name="OnTimer">OnTimer</a>(void)  </b><code>[protected virtual]</code></H3>
<p>A derivable method to call when a SIGALRM is being delivered
to a specific thread.
</p>
<H3><b>void <a name="ref29"></a><a name="OnPolling">OnPolling</a>(void)  </b><code>[protected virtual]</code></H3>
<p>A derived method to handle asynchronous I/O requests delivered
to the specified thread.
</p>
<H3><b>void <a name="ref30"></a><a name="OnSignal">OnSignal</a>(int signo)  </b><code>[protected virtual]</code></H3>
<p>A derivable method to call for delivering a signal event to
a specified thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
posix signal id.</td></tr>
</table>
</dl>
<H3><b>inline void <a name="ref31"></a><a name="Sleep">Sleep</a>(timeout_t msec)  </b><code>[protected]</code></H3>
<p>A thread-safe sleep call.  On most Posix systems, "sleep()"
is implimented with SIGALRM making it unusable from multipe
threads.  Pthread libraries often define an alternate "sleep"
handler such as usleep(), nanosleep(), or nap(), that is thread
safe, and also offers a higher timer resolution.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
msec</td><td align="left" valign="top">
timeout in milliseconds.</td></tr>
</table>
</dl>
<H3><b>inline void <a name="ref32"></a><a name="Exit">Exit</a>(void)  </b><code>[protected]</code></H3>
<p>Used to properly exit from a Thread derived Run() or Initial()
method.  Terminates execution of the current thread and calls
the derived classes Final() method.
</p>
<H3><b>void <a name="ref33"></a><a name="setTimer">setTimer</a>(timeout_t timer)  </b><code>[protected]</code></H3>
<p>Used to specify a timeout event that can be delivered to the
current thread via SIGALRM.  When the timer expires, the OnTimer() 
method is called for the thread.  At present, only one thread
timer can be active at any given time.  On some operating
systems (including Linux) a timer can be active on each thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
timer</td><td align="left" valign="top">
timeout in milliseconds.</td></tr>
</table>
</dl>
<H3><b>timeout_t <a name="ref34"></a><a name="getTimer">getTimer</a>(void)  </b><code>[protected]</code></H3>
<p>Gets the time remaining for the current threads timer before
it expires.
</p><p>
</p>
<dl><dt><b>Returns</b>:<dd>
time remaining before timer expires in milliseconds.</dl>
<H3><b>void <a name="ref35"></a><a name="endTimer">endTimer</a>(void)  </b><code>[protected]</code></H3>
<p>Terminates the timer before the timeout period has expired.
This prevents the timer from sending it's SIGALRM and makes
the timer available to other threads.
</p>
<H3><b>void <a name="ref36"></a><a name="WaitSignal">WaitSignal</a>(signo_t signo)  </b><code>[protected]</code></H3>
<p>Used to wait on a Posix signal from another thread.  This can be
used as a crude rondevious/synchronization method between threads.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
a posix signal id.</td></tr>
</table>
</dl>
<H3><b>void <a name="ref37"></a><a name="Yield">Yield</a>(void)  </b><code>[protected]</code></H3>
<p>Yeilds the current thread's CPU time slice to allow another thread to
begin immediate execution.
</p>
<H3><b>void <a name="ref38"></a><a name="setCancel">setCancel</a>(int mode)  </b><code>[protected]</code></H3>
<p>Sets thread cancellation mode.  Threads can either be set immune to
termination (THREAD_CANCEL_DISABLED), can be set to terminate when
reaching specific "thread cancellation points" (THREAD_CANCEL_DEFERRED)
or immediately when Terminate is requested (THREAD_CANCEL_IMMEDIATE).
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
mode</td><td align="left" valign="top">
for cancellation of the current thread.</td></tr>
</table>
</dl>
<H3><b>void <a name="ref39"></a><a name="setSuspend">setSuspend</a>(int mode)  </b><code>[protected]</code></H3>
<p>Sets the thread's ability to be suspended from execution.  The
thread may either have suspend enabled (THREAD_SUSPEND_ENABLE) or
disabled (THREAD_SUSPEND_DISABLE).
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
mode</td><td align="left" valign="top">
for suspend.</td></tr>
</table>
</dl>
<H3><b>void <a name="ref40"></a><a name="setSignal">setSignal</a>(int signo, bool mode)  </b><code>[protected]</code></H3>
<p>Used to enable or disable a signal within the current thread.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
signo</td><td align="left" valign="top">
posix signal id.</td></tr>
<tr><td align="left" valign="top">
active</td><td align="left" valign="top">
set to true to enable.</td></tr>
</table>
</dl>
<H3><b>void <a name="ref41"></a><a name="Terminate">Terminate</a>(void)  </b><code>[protected]</code></H3>
<p>Used by another thread to terminate the current thread.  Termination
actually occurs based on the current setCancel() mode.  When the
current thread does terminate, control is returned to the requesting
thread.  Terminate() should always be called at the start of any
destructor of a class derived from Thread to assure the remaining
part of the destructor is called without the thread still executing.
</p>
<HR>
<TABLE WIDTH="100%"><TR><TD ALIGN="left" VALIGN="top">

<UL><LI><I>Author</I>: David Sugar &lt;dyfet@tycho.com&gt; </LI>
<LI>Documentation generated by dyfet@home.sys on Thu Dec 16 09:54:26 EST 1999
</LI>
</UL></TD><TD ALIGN="RIGHT" VALIGN="TOP">
<b>K</b><i>doc</i>
</TD>
</TR></TABLE></BODY></HTML>