author | Claus Gittinger <cg@exept.de> |
Wed, 29 Jan 1997 15:27:21 +0100 | |
changeset 2302 | 259d1b9326ed |
parent 2268 | e7e1f98c3bce |
child 2384 | ceb4f8de635a |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1992 by Claus Gittinger |
159 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
Link subclass:#Process |
|
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
14 |
instanceVariableNames:'id prio state startBlock name restartable interruptActions |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
15 |
exitActions suspendSemaphore singleStepping |
1530
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
16 |
emergencySignalHandler suspendActions creatorId processGroupId' |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
17 |
classVariableNames:'TerminateSignal RestartSignal CoughtSignals' |
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
18 |
poolDictionaries:'' |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
19 |
category:'Kernel-Processes' |
1 | 20 |
! |
21 |
||
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
22 |
!Process class methodsFor:'documentation'! |
88 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1992 by Claus Gittinger |
|
159 | 27 |
All Rights Reserved |
88 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
Instances of Process represent lightweight smalltalk processes |
|
41 |
(i.e. threads). These all run in a shared smalltalk/X address space, |
|
93 | 42 |
and can thus access and communicate via any objects. |
43 |
Do not confuse these with (heavy-weight) unix processes, which are |
|
44 |
created differently, and do NOT run in the same address space. |
|
45 |
Also notice, that heavy-weight process creation takes much longer. |
|
46 |
(see OperatingSystemclass>>fork). |
|
47 |
||
202 | 48 |
Processes are typically created by sending #fork or #forkAt: to a block; |
49 |
the block creates a new process, defines itself as its startBlock, |
|
50 |
and (optionally) tells the Processor about the new process. |
|
51 |
||
93 | 52 |
Scheduling is done by Processor, which is the sole instance of |
88 | 53 |
ProcessorScheduler. |
93 | 54 |
|
202 | 55 |
Processes can be terminated either soft or via a hardTerminate. |
217 | 56 |
|
202 | 57 |
A soft terminate (see Process>>terminate) will raise a TerminationSignal |
217 | 58 |
in the process, which can be handled by the process. |
59 |
If no other handler was specified, the processes own handler |
|
60 |
(see Process>>start) will catch the signal and terminate the process. |
|
61 |
During this signal processing, normal unwind processing takes place, |
|
62 |
this means that with a soft terminate, all valueOnUnwind:/valueNowOrOnUnwind: |
|
63 |
cleanup blocks are evaluated. |
|
202 | 64 |
(so a process which has set up those blocks correctly does not have to |
65 |
care especially about cleanup in case of termination). |
|
217 | 66 |
Other than that, the TerminateSignal can be cought for special cleanup or |
67 |
even to make the process continue execution. |
|
202 | 68 |
|
69 |
A hard terminate (Process>>terminateNoSignal) will NOT do all of the above, |
|
70 |
but quickly (and without any cleanup) terminate the process. |
|
71 |
The debugger offers a quickTerminate option on its popupMenu for |
|
72 |
situations, when soft termination fails. (for example, if some error was |
|
73 |
coded into a handler or unwind block). |
|
74 |
||
75 |
Notice: |
|
1273 | 76 |
in Smalltalk/X, processes are gone, when an image is restarted; |
77 |
this means, that you have to take care of process re-creation yourself. |
|
78 |
Usually, this is done by depending on ObjectMemory, recreating the |
|
79 |
process(es) when the #returnFromSnapshot-change notifiction arrives. |
|
202 | 80 |
|
1273 | 81 |
All views (actually windowGroups) recreate their window process |
82 |
on image-restart. You have to do so manually for your own processes. |
|
93 | 83 |
|
84 |
A later version will allow specification of automatic restart, but |
|
217 | 85 |
thats not yet implemented. However, even when implemented, restartable processes |
86 |
will be recreated to restart from the beginning. It will not be possible to |
|
87 |
automatically continue a processes execution where it left off. |
|
88 |
This is a consequence of the portable implementation of ST/X, since in order to |
|
375 | 89 |
implement process continuation, the machines stack had to be preserved and |
90 |
recreated. Although this is possible to do (and actually not too complicated), |
|
91 |
this has not been implemented, since the machines stack layout is highly machine/compiler |
|
92 |
dependent, thus leading to much bigger porting effort of ST/X (which conflicts |
|
93 |
with ST/X's design goal of being highly portable). |
|
217 | 94 |
|
95 |
Process synchronization: |
|
1273 | 96 |
Synchronization with cooperating processes is supported as usual, |
97 |
via Semaphores (see Semaphore, Delay, SharedQueue etc.) |
|
375 | 98 |
|
1273 | 99 |
With uncooperative processes, only synchronization on suspend |
100 |
and termination is possible: |
|
101 |
any other process can wait for a process to suspend or terminate. |
|
102 |
This waiting is implemented by using suspendSemaphore and exitBlocks |
|
103 |
(where an exitSemaphore is signalled). |
|
104 |
See waitUntilSuspended / waitUntilTerminated. |
|
105 |
||
106 |
[Instance variables:] |
|
93 | 107 |
|
1273 | 108 |
id <SmallInteger> a unique process-id |
93 | 109 |
|
2197 | 110 |
creatorId <SmallInteger> the id of the process that |
111 |
created me (useful for debugging |
|
112 |
or monitoring). |
|
113 |
||
114 |
processGroupId usually the id of the creator, |
|
115 |
unless the process detached from |
|
116 |
the group and became a groupLeader. |
|
117 |
Groups can be easily terminated |
|
118 |
as a whole. |
|
119 |
Group leaders have a groupId of nil. |
|
120 |
A groupId of 0 (zero) marks a system |
|
121 |
process; these do not prevent a standAlone |
|
122 |
app from exiting. |
|
123 |
||
1273 | 124 |
prio <SmallInteger> the processes priority |
202 | 125 |
|
1273 | 126 |
state <Symbol> the processes state |
127 |
(for process-monitor) |
|
202 | 128 |
|
1273 | 129 |
startBlock <Block> the startup-block (the one that forked) |
202 | 130 |
|
1273 | 131 |
name <String-or-nil> the processes name (if any) |
132 |
(for process-monitor) |
|
202 | 133 |
|
1273 | 134 |
suspendSemaphore <Semaphore> triggered when suspend (if nonNil) |
217 | 135 |
|
2197 | 136 |
restartable <Boolean> is restartable; if true, the process |
137 |
will be restarted when an image is |
|
138 |
restarted. Otherwise, it remains dead. |
|
139 |
Running processes cannot be continued |
|
140 |
at the point where leftOff after an |
|
141 |
image-restart. |
|
202 | 142 |
|
1273 | 143 |
interruptActions <Collection> interrupt actions as defined by interruptWith:, |
144 |
performed at interrupt time |
|
202 | 145 |
|
1273 | 146 |
exitActions <Collection of Block> |
147 |
additional cleanup actions to perform |
|
148 |
on termination (if nonEmpty) |
|
202 | 149 |
|
1273 | 150 |
emergencySignalHandler <Block> can be used for per-process |
151 |
emergency signal handling |
|
152 |
[Class variables:] |
|
159 | 153 |
|
1273 | 154 |
TerminateSignal <Signal> signal used to terminate processes |
155 |
(should not be cought - or at least |
|
2197 | 156 |
rejected in handlers). |
157 |
If cought and proceeded, a process |
|
158 |
cannot be terminated via #terminate. |
|
159 |
For hardTermination (in case of emergency), |
|
160 |
send it a #erminateNoSignal message. |
|
161 |
||
162 |
RestartSignal <Signal> signal used to restart a process. |
|
163 |
Can be cought in additional handler(s), |
|
164 |
to perform all kind of re-initialization. |
|
165 |
However, these handlers should reject, |
|
166 |
for the restart to be really performed. |
|
1273 | 167 |
|
168 |
[see also:] |
|
169 |
ProcessorScheduler |
|
170 |
Block |
|
171 |
Sempahore SemaphoreSet Delay SharedQueue |
|
172 |
WindowGroup |
|
1346
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
173 |
(``Working with processes'': programming/processes.html) |
1273 | 174 |
|
1294 | 175 |
[author:] |
176 |
Claus Gittinger |
|
177 |
||
88 | 178 |
" |
213 | 179 |
! |
180 |
||
181 |
examples |
|
182 |
" |
|
183 |
start a background process, computing 1000 factorial 100 times; |
|
184 |
the processes priority is set to not disturb any interactive process. |
|
185 |
Since its prio is higher than the 3D animation demos prio, you will notice, |
|
186 |
that those are suspended while the computation runs. But Interactive views |
|
187 |
(like browsers) will continue to react normal. |
|
1316 | 188 |
[exBegin] |
213 | 189 |
[ |
190 |
'starting' printNL. |
|
191 |
100 timesRepeat:[1000 factorial]. |
|
192 |
'done with factorial' printNL. |
|
193 |
] forkAt:(Processor userBackgroundPriority). |
|
1316 | 194 |
[exEnd] |
213 | 195 |
|
196 |
||
197 |
start a background process, computing 1000 factorial 100 times; |
|
198 |
the processes priority is set to not disturb any process. |
|
199 |
The prio is set to 1 (which is the lowest possible) notice that now, |
|
200 |
the 3D animation demos also continue to run. |
|
1316 | 201 |
[exBegin] |
213 | 202 |
[ |
203 |
'starting' printNL. |
|
204 |
100 timesRepeat:[1000 factorial]. |
|
205 |
'done with factorial' printNL. |
|
206 |
] forkAt:1. |
|
1316 | 207 |
[exEnd] |
213 | 208 |
|
209 |
||
210 |
start a background process, reading a pipe without blocking other |
|
211 |
processes; |
|
1316 | 212 |
[exBegin] |
213 | 213 |
[ |
214 |
|p| |
|
215 |
||
216 |
'starting' printNL. |
|
217 |
p := PipeStream readingFrom:'ls -lR .'. |
|
218 |
[p atEnd] whileFalse:[ |
|
1316 | 219 |
p readWait. |
220 |
p nextLine printNL. |
|
213 | 221 |
]. |
222 |
p close. |
|
223 |
'done with pipe' printNL. |
|
224 |
] forkAt:1. |
|
1316 | 225 |
[exEnd] |
213 | 226 |
|
227 |
see more examples in doc/coding |
|
228 |
(or search in the browser for senders of fork*) |
|
229 |
" |
|
88 | 230 |
! ! |
1 | 231 |
|
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
232 |
!Process class methodsFor:'initialization'! |
159 | 233 |
|
234 |
initialize |
|
235 |
TerminateSignal isNil ifTrue:[ |
|
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
236 |
TerminateSignal := Signal new mayProceed:true. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
237 |
TerminateSignal nameClass:self message:#terminateSignal. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
238 |
TerminateSignal notifierString:'unhandled process termination'. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
239 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
240 |
RestartSignal := Signal new mayProceed:true. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
241 |
RestartSignal nameClass:self message:#restartSignal. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
242 |
RestartSignal notifierString:'unhandled process restart'. |
302 | 243 |
|
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
244 |
CoughtSignals := SignalSet |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
245 |
with:AbortSignal |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
246 |
with:TerminateSignal |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
247 |
with:RestartSignal. |
159 | 248 |
] |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
249 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
250 |
"Modified: 28.10.1996 / 20:39:05 / cg" |
159 | 251 |
! ! |
252 |
||
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
253 |
!Process class methodsFor:'instance creation'! |
699 | 254 |
|
255 |
for:aBlock priority:aPrio |
|
256 |
"create a new (unscheduled) process which will execute aBlock at |
|
257 |
a given priority, once scheduled. The process will start execution once |
|
258 |
it gets a #resume-message." |
|
259 |
||
2268
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
260 |
^ self basicNew for:aBlock priority:aPrio |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
261 |
|
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
262 |
"Modified: 25.1.1997 / 01:23:12 / cg" |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
263 |
! |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
264 |
|
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
265 |
new |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
266 |
"create a new (unscheduled) process which will execute the start |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
267 |
method, when scheduled. The process will start execution once |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
268 |
it gets a #resume-message." |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
269 |
|
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
270 |
^ self basicNew for:nil priority:(Processor activePriority). |
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
271 |
|
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
272 |
"Created: 25.1.1997 / 01:31:05 / cg" |
699 | 273 |
! ! |
274 |
||
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
275 |
!Process class methodsFor:'Signal constants'! |
159 | 276 |
|
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
277 |
restartSignal |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
278 |
"return the signal used for process restart" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
279 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
280 |
^ RestartSignal |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
281 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
282 |
"Created: 28.10.1996 / 20:26:50 / cg" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
283 |
! |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
284 |
|
159 | 285 |
terminateSignal |
202 | 286 |
"return the signal used for process termination" |
287 |
||
159 | 288 |
^ TerminateSignal |
289 |
! ! |
|
290 |
||
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
291 |
!Process class methodsFor:'defaults'! |
1346
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
292 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
293 |
defaultMaximumStackSize |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
294 |
"return the default max stack size. All new processes get |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
295 |
this limit initially. |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
296 |
It may be changed for individual processes with: |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
297 |
aProcess setMaximumStackSize:limit" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
298 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
299 |
%{ /* NOCONTEXT */ |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
300 |
|
1352 | 301 |
RETURN ( __MKSMALLINT( __defaultThreadMaxStackSize() )); |
1346
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
302 |
%} |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
303 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
304 |
" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
305 |
Process defaultMaximumStackSize |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
306 |
" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
307 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
308 |
"Modified: 8.5.1996 / 10:22:24 / cg" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
309 |
! |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
310 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
311 |
defaultMaximumStackSize:numberOfBytes |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
312 |
"set the default max stack size, return the previous value. |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
313 |
All new processes get this stack limit initially. |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
314 |
It may be changed for individual processes with: |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
315 |
aProcess setMaximumStackSize:limit |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
316 |
Notice: |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
317 |
There is seldom any need to change the default setting, |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
318 |
except for highly recursive programs." |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
319 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
320 |
%{ /* NOCONTEXT */ |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
321 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
322 |
if (__isSmallInteger(numberOfBytes)) { |
1352 | 323 |
RETURN ( __MKSMALLINT( __setDefaultThreadSetMaxStackSize(__intVal(numberOfBytes)) )); |
324 |
} |
|
1346
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
325 |
%} |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
326 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
327 |
" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
328 |
Process defaultMaximumStackSize:500*1024 |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
329 |
" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
330 |
|
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
331 |
"Modified: 8.5.1996 / 10:23:26 / cg" |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
332 |
! ! |
429d560b7013
allow access to the default stack limit
Claus Gittinger <cg@exept.de>
parents:
1316
diff
changeset
|
333 |
|
1980
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
334 |
!Process methodsFor:'Compatibility - V''Age'! |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
335 |
|
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
336 |
queueInterrupt:aBlock |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
337 |
"VisualAge compatibility: alias for #interruptWith: |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
338 |
arrange for the receiver process to be interrupted and |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
339 |
evaluate aBlock in its interrupt handler." |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
340 |
|
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
341 |
^ self interruptWith:aBlock |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
342 |
|
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
343 |
"Created: 15.11.1996 / 11:41:06 / cg" |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
344 |
! ! |
173122fed8e2
added V'Age compatibility method
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
345 |
|
699 | 346 |
!Process methodsFor:'accessing'! |
347 |
||
1531
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
348 |
beGroupLeader |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
349 |
"make the receiver a processGroupLeader. |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
350 |
This detaches the process from its creator, so that it will not |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
351 |
be terminated when it teminates via #terminateGroup. |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
352 |
(windowgroup processes do this)." |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
353 |
|
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
354 |
processGroupId := id |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
355 |
|
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
356 |
"Modified: 8.7.1996 / 14:00:35 / cg" |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
357 |
"Created: 8.7.1996 / 14:08:44 / cg" |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
358 |
! |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
359 |
|
2196 | 360 |
beSystemProcess |
361 |
"make the receiver a system process. |
|
362 |
These processes have a groupId of 0. |
|
363 |
When executed as standAlone application, smalltalk exits when |
|
364 |
no more user processes are running. |
|
365 |
To prevent any daemon processes from preventing this exit, |
|
366 |
you should make the systemProcess" |
|
367 |
||
368 |
processGroupId := 0 |
|
369 |
||
370 |
"Created: 17.1.1997 / 21:42:46 / cg" |
|
371 |
! |
|
372 |
||
699 | 373 |
changePriority:aNumber |
374 |
"same as priority:, but returns the old priority. |
|
818 | 375 |
(cannot do this in #priority: for ST-80 compatibility)" |
699 | 376 |
|
377 |
|oldPrio| |
|
378 |
||
379 |
oldPrio := prio. |
|
380 |
Processor changePriority:aNumber for:self. |
|
381 |
^ oldPrio |
|
818 | 382 |
|
383 |
"Modified: 23.12.1995 / 18:38:53 / cg" |
|
699 | 384 |
! |
385 |
||
1530
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
386 |
creatorId |
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
387 |
"return the processcreators id. |
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
388 |
This has no semantic meaning, but is useful to identify processes |
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
389 |
when debugging." |
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
390 |
|
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
391 |
^ creatorId |
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
392 |
! |
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
393 |
|
818 | 394 |
id |
395 |
"return the processes id" |
|
396 |
||
397 |
^ id |
|
398 |
! |
|
399 |
||
400 |
name |
|
401 |
"return the processes name" |
|
402 |
||
403 |
^ name |
|
404 |
! |
|
405 |
||
406 |
name:aString |
|
407 |
"set the processes name" |
|
408 |
||
409 |
name := aString |
|
410 |
! |
|
411 |
||
412 |
priority |
|
413 |
"return the receivers priority" |
|
414 |
||
415 |
^ prio |
|
416 |
! |
|
417 |
||
418 |
priority:aNumber |
|
419 |
"set my priority" |
|
420 |
||
421 |
Processor changePriority:aNumber for:self. |
|
422 |
! |
|
423 |
||
1529
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
424 |
processGroupId |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
425 |
"return the processes processGroup id. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
426 |
Normally, when created, a processes creator id is taken and used |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
427 |
as the processGroup id. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
428 |
When #terminateGroup is sent to a process, the process and all of its |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
429 |
group members are terminated together. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
430 |
|
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
431 |
Processes can detach themself from the process group to prevent being |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
432 |
killed when the parent terminates (windowgroup processes do this)." |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
433 |
|
1530
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
434 |
^ processGroupId |
1529
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
435 |
|
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
436 |
"Created: 8.7.1996 / 13:47:47 / cg" |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
437 |
! |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
438 |
|
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
439 |
processGroupId:aGroupLeadersProcessID |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
440 |
"set the processes processGroup id. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
441 |
Normally, when created, a processes creator id is taken and used |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
442 |
as the processGroup id. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
443 |
When #terminateGroup is sent to a process, the process and all of its |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
444 |
group members are terminated together. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
445 |
|
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
446 |
Processes can detach themself from the process group to prevent being |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
447 |
killed when the parent terminates (windowgroup processes do this)." |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
448 |
|
1530
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
449 |
processGroupId := aGroupLeadersProcessID |
1529
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
450 |
|
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
451 |
"Created: 8.7.1996 / 13:47:53 / cg" |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
452 |
! |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
453 |
|
818 | 454 |
restartable:aBoolean |
455 |
"set/clear, the restartable flag. |
|
456 |
Restartable processes will automatically be restarted by the |
|
457 |
ProcessorScheduler upon image restart. |
|
458 |
Others have to be restarted manually." |
|
459 |
||
460 |
startBlock isNil ifTrue:[ |
|
461 |
self error:'cannot be made restartable when already started'. |
|
462 |
^ self |
|
463 |
]. |
|
464 |
restartable := aBoolean |
|
465 |
||
466 |
"Modified: 23.12.1995 / 18:38:32 / cg" |
|
467 |
! |
|
468 |
||
469 |
singleStep:aBoolean |
|
470 |
singleStepping := aBoolean |
|
471 |
! |
|
472 |
||
473 |
startBlock |
|
474 |
"return the processes startup-block" |
|
475 |
||
476 |
^ startBlock |
|
477 |
! |
|
478 |
||
479 |
state |
|
480 |
"return a symbol describing the processes state" |
|
481 |
||
482 |
^ state |
|
483 |
! |
|
484 |
||
485 |
state:aSymbol |
|
486 |
"set the state - only to be used from scheduler" |
|
487 |
||
488 |
state := aSymbol |
|
489 |
! |
|
490 |
||
491 |
suspendedContext |
|
492 |
"return the processes suspended context |
|
493 |
- this is the context from which a process switch into the scheduler |
|
494 |
or another process occured. |
|
495 |
Typically, only the debugger is interested in this one." |
|
496 |
||
497 |
%{ /* NOCONTEXT */ |
|
498 |
OBJ i; |
|
499 |
||
1133 | 500 |
if (__isSmallInteger(i = __INST(id))) { |
501 |
RETURN (__threadContext(__intVal(i))); |
|
818 | 502 |
} |
503 |
%}. |
|
504 |
^ nil |
|
505 |
! ! |
|
506 |
||
507 |
!Process methodsFor:'accessing-change notifications'! |
|
508 |
||
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
509 |
addExitAction:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
510 |
"add aBlock to the processes exit actions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
511 |
This block will be evaluated right before the process dies." |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
512 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
513 |
exitActions isNil ifTrue:[ |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
514 |
exitActions := OrderedCollection new |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
515 |
]. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
516 |
exitActions add:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
517 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
518 |
"Created: 12.1.1997 / 00:34:51 / cg" |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
519 |
! |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
520 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
521 |
addSuspendAction:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
522 |
"add aBlock to the processes suspend actions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
523 |
This block will be evaluated when a process gets suspended." |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
524 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
525 |
suspendActions isNil ifTrue:[ |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
526 |
suspendActions := OrderedCollection new |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
527 |
]. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
528 |
suspendActions add:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
529 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
530 |
"Modified: 13.12.1995 / 13:44:31 / stefan" |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
531 |
"Created: 12.1.1997 / 00:35:11 / cg" |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
532 |
! |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
533 |
|
699 | 534 |
emergencySignalHandler |
535 |
"return the emergencySignalHandler block. |
|
536 |
See Signal>>documentation for more info." |
|
537 |
||
538 |
^ emergencySignalHandler |
|
539 |
! |
|
540 |
||
541 |
emergencySignalHandler:aOneArgBlock |
|
542 |
"set the emergencySignalHandler block. |
|
543 |
See Signal>>documentation for more info." |
|
544 |
||
545 |
emergencySignalHandler := aOneArgBlock |
|
546 |
! |
|
547 |
||
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
548 |
removeAllExitActions |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
549 |
"remove all exit actions." |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
550 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
551 |
exitActions := nil. |
699 | 552 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
553 |
"Created: 12.1.1997 / 00:36:02 / cg" |
699 | 554 |
! |
555 |
||
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
556 |
removeAllSuspendActions |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
557 |
"remove all suspend actions." |
699 | 558 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
559 |
suspendActions := nil. |
699 | 560 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
561 |
"Created: 12.1.1997 / 00:36:16 / cg" |
818 | 562 |
! ! |
699 | 563 |
|
818 | 564 |
!Process methodsFor:'accessing-stack'! |
699 | 565 |
|
566 |
maximumStackSize |
|
567 |
"returns the processes stack limit - i.e. the process will be |
|
568 |
interrupted with a recursionSignal-raise, if it ever |
|
569 |
needs more stack (in bytes) than this number" |
|
570 |
||
571 |
%{ /* NOCONTEXT */ |
|
572 |
extern int __threadMaxStackSize(); |
|
573 |
OBJ i; |
|
574 |
||
1133 | 575 |
if (__isSmallInteger(i = __INST(id))) { |
576 |
RETURN( __MKSMALLINT(__threadMaxStackSize(__intVal(i))) ); |
|
699 | 577 |
} |
578 |
%}. |
|
579 |
^ nil |
|
580 |
! |
|
581 |
||
582 |
setMaximumStackSize:limit |
|
583 |
"sets the processes stack limit - i.e. the process will be |
|
584 |
interrupted with a recursionSignal-raise, if it ever |
|
585 |
needs more stack (in bytes) than this number. |
|
586 |
Returns the old value." |
|
587 |
||
588 |
%{ /* NOCONTEXT */ |
|
589 |
extern int __threadSetMaxStackSize(); |
|
590 |
OBJ i; |
|
591 |
||
1133 | 592 |
if (__isSmallInteger(i = __INST(id)) |
699 | 593 |
&& __isSmallInteger(limit) ) { |
1133 | 594 |
RETURN ( __MKSMALLINT(__threadSetMaxStackSize(__intVal(i), __intVal(limit))) ); |
699 | 595 |
} |
596 |
%}. |
|
597 |
^ nil |
|
598 |
! |
|
599 |
||
712
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
600 |
setStackInitialSize:initial increment:increment safe:safe |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
601 |
"hook for fine-tuning. Sets the processes initialStackSize- and |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
602 |
and stackIncrement-parameters. Not for normal use." |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
603 |
|
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
604 |
%{ /* NOCONTEXT */ |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
605 |
extern int __threadSetJunkSizes(); |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
606 |
OBJ i; |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
607 |
|
1133 | 608 |
if (__isSmallInteger(i = __INST(id)) |
712
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
609 |
&& __isSmallInteger(initial) |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
610 |
&& __isSmallInteger(increment) |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
611 |
&& __isSmallInteger(safe)) { |
1133 | 612 |
RETURN ( __threadSetJunkSizes(__intVal(i), __intVal(initial), __intVal(increment), __intVal(safe)) ? true : false ); |
712
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
613 |
} |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
614 |
%}. |
40906c842cd2
added entry to control a processes stack allocation
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
615 |
^ false |
699 | 616 |
! ! |
617 |
||
618 |
!Process methodsFor:'interrupts'! |
|
619 |
||
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
620 |
addInterruptAction:aBlock |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
621 |
"make the receiver evaluate aBlock when resumed/interrupted. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
622 |
The name is somewhat misleading (actually, its historic): |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
623 |
the block is also evaluated on resume." |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
624 |
|
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
625 |
self uninterruptablyDo:[ |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
626 |
interruptActions isNil ifTrue:[ |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
627 |
interruptActions := OrderedCollection with:aBlock. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
628 |
] ifFalse:[ |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
629 |
interruptActions addLast:aBlock. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
630 |
]. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
631 |
]. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
632 |
|
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
633 |
"Created: 5.3.1996 / 17:10:10 / cg" |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
634 |
"Modified: 8.3.1996 / 13:03:10 / cg" |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
635 |
! |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
636 |
|
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
637 |
forceInterruptOnReturnOf:aContext |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
638 |
"helper entry for debugger. Force a stepInterrupt whenever aContext |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
639 |
returns either directly or via an unwind." |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
640 |
|
1728 | 641 |
aContext markForInterruptOnUnwind. |
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
642 |
%{ |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
643 |
OBJ i; |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
644 |
|
1133 | 645 |
if (__isSmallInteger(i = __INST(id))) { |
1728 | 646 |
__threadContextStepInterrupt(__intVal(i), 1); |
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
647 |
} |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
648 |
%} |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
649 |
|
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
650 |
! |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
651 |
|
699 | 652 |
interrupt |
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
653 |
"evaluate my interrupt-actions. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
654 |
The process will go back to where it got interrupted |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
655 |
after doing this." |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
656 |
|
699 | 657 |
|action| |
658 |
||
1165
c9108e9a4fdd
just to make certain: disable interrupts when removing interruptAction
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
659 |
[interruptActions size > 0] whileTrue:[ |
c9108e9a4fdd
just to make certain: disable interrupts when removing interruptAction
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
660 |
self uninterruptablyDo:[ |
c9108e9a4fdd
just to make certain: disable interrupts when removing interruptAction
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
661 |
action := interruptActions removeFirst |
c9108e9a4fdd
just to make certain: disable interrupts when removing interruptAction
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
662 |
]. |
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
663 |
action value |
699 | 664 |
]. |
665 |
interruptActions := nil |
|
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
666 |
|
1165
c9108e9a4fdd
just to make certain: disable interrupts when removing interruptAction
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
667 |
"Modified: 12.4.1996 / 12:43:31 / cg" |
699 | 668 |
! |
669 |
||
670 |
interruptWith:aBlock |
|
671 |
"interrupt the receiver and make it evaluate aBlock. |
|
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
672 |
If the receiver is currently suspended it is resumed. |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
673 |
Notice, that the process will only perform the block immediately, |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
674 |
IFF its priority is higher than the current processes priority. |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
675 |
Otherwise, it will remain suspended, until its time comes." |
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
676 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
677 |
Processor activeProcess == self ifTrue:[ |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
678 |
aBlock value |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
679 |
] ifFalse:[ |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
680 |
self addInterruptAction:aBlock. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
681 |
Processor scheduleForInterrupt:self. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
682 |
] |
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
683 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
684 |
"Modified: 12.1.1997 / 00:52:05 / cg" |
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
685 |
! |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
686 |
|
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
687 |
interruptedIn:aContext |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
688 |
"evaluate my interrupt-actions. |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
689 |
The process will go back to where it got interrupted |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
690 |
after doing this." |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
691 |
|
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
692 |
|action| |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
693 |
|
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
694 |
[interruptActions size > 0] whileTrue:[ |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
695 |
self uninterruptablyDo:[ |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
696 |
action := interruptActions removeFirst |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
697 |
]. |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
698 |
action numArgs == 1 ifTrue:[ |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
699 |
action value:aContext |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
700 |
] ifFalse:[ |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
701 |
action value |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
702 |
] |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
703 |
]. |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
704 |
interruptActions := nil |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
705 |
|
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
706 |
"Created: 18.10.1996 / 20:43:39 / cg" |
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
707 |
"Modified: 18.10.1996 / 20:47:20 / cg" |
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
708 |
! |
699 | 709 |
|
1092
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
710 |
onResumeDo:aBlock |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
711 |
"prepare for the receiver to evaluate aBlock when resumed. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
712 |
This is like #interruptWith:, but does not resume the receiver |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
713 |
(i.e. it continues its sleep). |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
714 |
This is useful to place a breakpoint on a sleeping process, to be fired |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
715 |
when it awakes." |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
716 |
|
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
717 |
self addInterruptAction:aBlock. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
718 |
Processor scheduleInterruptActionsOf:self. |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
719 |
|
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
720 |
"Created: 5.3.1996 / 17:28:04 / cg" |
2a8acc60f5b5
added mechanism for a block to be evaluated onResume
Claus Gittinger <cg@exept.de>
parents:
1086
diff
changeset
|
721 |
"Modified: 8.3.1996 / 13:01:21 / cg" |
699 | 722 |
! ! |
723 |
||
724 |
!Process methodsFor:'monitoring'! |
|
725 |
||
726 |
numberOfStackBoundaryHits |
|
727 |
"internal monitoring only - will vanish" |
|
728 |
||
729 |
%{ /* NOCONTEXT */ |
|
730 |
extern int __threadNumberOfStackBoundaryHits(); |
|
731 |
int n; |
|
732 |
OBJ i; |
|
159 | 733 |
|
1133 | 734 |
if (__isSmallInteger(i = __INST(id))) { |
735 |
n = __threadNumberOfStackBoundaryHits(__intVal(i)); |
|
699 | 736 |
n &= 0x3FFFFFFF; |
1133 | 737 |
RETURN( __MKSMALLINT(n) ); |
699 | 738 |
} |
739 |
%}. |
|
740 |
^ nil |
|
741 |
! |
|
742 |
||
743 |
numberOfStackSegments |
|
744 |
"return the processes number of stack segments currently used. |
|
745 |
This method is for monitoring purposes only - it may vanish." |
|
746 |
||
747 |
%{ /* NOCONTEXT */ |
|
748 |
extern int __threadTotalStackSize(); |
|
749 |
OBJ i; |
|
750 |
||
1133 | 751 |
if (__isSmallInteger(i = __INST(id))) { |
752 |
RETURN( __MKSMALLINT(__threadStackSegments(__intVal(i))) ); |
|
699 | 753 |
} |
754 |
%}. |
|
755 |
^ nil |
|
756 |
! |
|
757 |
||
758 |
totalStackSize |
|
759 |
"return the processes maximum used stack size. |
|
760 |
This method is for monitoring purposes only - it may vanish." |
|
761 |
||
762 |
%{ /* NOCONTEXT */ |
|
763 |
extern int __threadTotalStackSize(); |
|
764 |
OBJ i; |
|
765 |
||
1133 | 766 |
if (__isSmallInteger(i = __INST(id))) { |
767 |
RETURN( __MKSMALLINT(__threadTotalStackSize(__intVal(i))) ); |
|
699 | 768 |
} |
769 |
%}. |
|
770 |
^ nil |
|
771 |
! |
|
772 |
||
773 |
usedStackSize |
|
774 |
"Return the processes current stack size. |
|
775 |
This method is for monitoring purposes only - it may vanish." |
|
776 |
||
777 |
%{ /* NOCONTEXT */ |
|
778 |
extern int __threadUsedStackSize(); |
|
779 |
OBJ i; |
|
780 |
||
1133 | 781 |
if (__isSmallInteger(i = __INST(id))) { |
782 |
RETURN( __MKSMALLINT(__threadUsedStackSize(__intVal(i))) ); |
|
699 | 783 |
} |
784 |
%}. |
|
785 |
^ nil |
|
786 |
! |
|
787 |
||
788 |
vmTrace:aBoolean |
|
789 |
"turn on/off VM message tracing for the receiver. |
|
790 |
This is meant for ST/X debugging, and may vanish. |
|
791 |
Expect lots of output, once this is turned on." |
|
792 |
||
793 |
%{ /* NOCONTEXT */ |
|
794 |
OBJ i; |
|
795 |
||
1133 | 796 |
if (__isSmallInteger(i = __INST(id))) { |
797 |
__threadTracing(__intVal(i), aBoolean); |
|
699 | 798 |
} |
799 |
%}. |
|
800 |
! ! |
|
801 |
||
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
802 |
!Process methodsFor:'obsolete'! |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
803 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
804 |
exitAction:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
805 |
"Obsoleted by addExitAction: / removeAllExitActions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
806 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
807 |
Add aBlock to the processes exit actions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
808 |
This block will be evaluated right before the process dies. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
809 |
An argument of nil removes all exitActions." |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
810 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
811 |
self obsoleteMethodWarning:'use addExitAction: / removeAllExitActions'. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
812 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
813 |
aBlock isNil ifTrue:[ |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
814 |
^ self removeAllExitActions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
815 |
]. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
816 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
817 |
^ self addExitAction:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
818 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
819 |
"Modified: 13.12.1995 / 13:44:03 / stefan" |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
820 |
"Modified: 12.1.1997 / 00:39:59 / cg" |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
821 |
! |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
822 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
823 |
suspendAction:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
824 |
"Obsoleted by addSuspendAction: / removeAllSuspendActions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
825 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
826 |
Add aBlock to the processes suspend actions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
827 |
This block will be evaluated when a process gets suspended. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
828 |
A nil argument removes all suspendActions." |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
829 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
830 |
self obsoleteMethodWarning:'use addSuspendAction: / removeAllSuspendActions'. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
831 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
832 |
aBlock isNil ifTrue:[ |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
833 |
^ self removeAllSuspendActions. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
834 |
]. |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
835 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
836 |
^ self addSuspendAction:aBlock |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
837 |
|
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
838 |
"Modified: 12.1.1997 / 00:38:22 / cg" |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
839 |
! ! |
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
840 |
|
699 | 841 |
!Process methodsFor:'printing & storing'! |
842 |
||
843 |
printOn:aStream |
|
844 |
"a little more info in my printed representation" |
|
845 |
||
846 |
aStream nextPutAll:state article; |
|
847 |
space; |
|
848 |
nextPutAll:state; |
|
849 |
nextPutAll:' Process ('; |
|
850 |
nextPutAll:self nameOrId; |
|
851 |
nextPutAll:')' |
|
159 | 852 |
! ! |
853 |
||
854 |
!Process methodsFor:'private'! |
|
855 |
||
856 |
for:aBlock priority:aPrio |
|
857 |
"setup the new process - the receiver is not scheduled for |
|
858 |
execution, to get it running, send it #resume" |
|
859 |
||
339 | 860 |
|nm active| |
159 | 861 |
|
862 |
prio := aPrio. |
|
863 |
startBlock := aBlock. |
|
339 | 864 |
restartable := false. |
159 | 865 |
|
866 |
(Processor newProcessFor:self) ifFalse:[ |
|
1529
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
867 |
"for some reason, the Processor was unable to create |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
868 |
a VM process for me ...." |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
869 |
^ nil |
159 | 870 |
]. |
871 |
||
872 |
" |
|
873 |
give me a user-friendly name |
|
874 |
" |
|
339 | 875 |
active := Processor activeProcess. |
2268
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
876 |
(nm := active name) notNil ifTrue:[ |
1529
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
877 |
" |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
878 |
avoid name inflation |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
879 |
" |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
880 |
(nm endsWith:' sub') ifFalse:[ |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
881 |
nm := nm , ' [' , active id printString , '] sub' |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
882 |
]. |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
883 |
name := nm |
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
884 |
]. |
1530
dfa58f01505c
remember creating processes id - helpful when debugging
Claus Gittinger <cg@exept.de>
parents:
1529
diff
changeset
|
885 |
processGroupId := creatorId := active id |
1529
0ba3d19f90d6
set the processGroupId when created
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
886 |
|
2268
e7e1f98c3bce
allow Process new (for subclasses)
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
887 |
"Modified: 25.1.1997 / 01:28:54 / cg" |
159 | 888 |
! ! |
889 |
||
699 | 890 |
!Process methodsFor:'private scheduler access'! |
1 | 891 |
|
699 | 892 |
setId:idNumber state:stateSymbol |
893 |
"set id and state - not for public use" |
|
375 | 894 |
|
699 | 895 |
id := idNumber. |
1844 | 896 |
creatorId := processGroupId := 0. |
699 | 897 |
state := stateSymbol. |
1844 | 898 |
|
899 |
"Modified: 30.10.1996 / 00:35:29 / cg" |
|
182 | 900 |
! |
901 |
||
159 | 902 |
setPriority:aNumber |
903 |
"set priority without telling processor - not for public use" |
|
904 |
||
905 |
prio := aNumber |
|
906 |
! |
|
907 |
||
908 |
setStartBlock:aBlock |
|
909 |
"set the receivers startup block" |
|
910 |
||
911 |
startBlock := aBlock |
|
912 |
! |
|
13 | 913 |
|
159 | 914 |
setStateTo:newState if:oldState |
915 |
state == oldState ifTrue:[state := newState] |
|
916 |
! |
|
917 |
||
918 |
setStateTo:newState if:oldState1 or:oldState2 |
|
919 |
(state == oldState1 or:[state == oldState2]) ifTrue:[state := newState] |
|
699 | 920 |
! ! |
921 |
||
818 | 922 |
!Process methodsFor:'queries'! |
923 |
||
924 |
isDead |
|
925 |
"return true, iff the receiver is a dead process" |
|
926 |
||
927 |
^ (state isNil or:[state == #dead]) |
|
928 |
||
929 |
"Modified: 23.12.1995 / 18:35:29 / cg" |
|
930 |
! |
|
931 |
||
932 |
isRestartable |
|
933 |
"return true, iff the receiver is restartable" |
|
934 |
||
935 |
^ restartable |
|
936 |
! |
|
937 |
||
938 |
isSingleStepping |
|
939 |
^ singleStepping |
|
940 |
! |
|
941 |
||
942 |
nameOrId |
|
943 |
"return a string to identify the process - either name or id" |
|
944 |
||
945 |
name notNil ifTrue:[^ name]. |
|
946 |
^ id printString |
|
947 |
! ! |
|
948 |
||
699 | 949 |
!Process methodsFor:'special'! |
950 |
||
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
951 |
millisecondDelay:millis |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
952 |
"suspend the current process for some time. |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
953 |
If the receiver is a system process (i.e. scheduler or event dispatcher) |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
954 |
this blocks the whole smalltalk for the time delta; |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
955 |
if its a normal thread, only that thread is suspended." |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
956 |
|
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
957 |
(Processor isSystemProcess:self) ifTrue:[ |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
958 |
OperatingSystem millisecondDelay:millis |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
959 |
] ifFalse:[ |
874 | 960 |
Delay waitForMilliseconds:millis |
772
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
961 |
] |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
962 |
|
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
963 |
"Created: 16.12.1995 / 13:10:53 / cg" |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
964 |
! |
f86b117950c5
non-blocking/blocking millisecondDelay added
Claus Gittinger <cg@exept.de>
parents:
759
diff
changeset
|
965 |
|
699 | 966 |
trapRestrictedMethods:trap |
967 |
"Allow/deny the execution of restricted methods. |
|
968 |
Process specific method restriction is not implemented yet, so this call is |
|
969 |
redirected to ObjectMemory and causes a system wide restriction. |
|
970 |
||
971 |
Notice: method restriction is a nonstandard feature, not supported |
|
972 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
973 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
974 |
It may change or even vanish (if it shows to be not useful)." |
|
975 |
||
976 |
^ObjectMemory trapRestrictedMethods:trap |
|
977 |
||
978 |
" |
|
979 |
Processor activeProcess trapRestrictedMethods:true |
|
980 |
Processor activeProcess trapRestrictedMethods:false |
|
981 |
" |
|
982 |
||
983 |
"Created: 8.11.1995 / 19:45:04 / stefan" |
|
984 |
! |
|
985 |
||
986 |
uninterruptablyDo:aBlock |
|
987 |
"execute aBlock with interrupts blocked. |
|
988 |
This does not prevent preemption by a higher priority processes |
|
989 |
if any becomes runnable due to the evaluation of aBlock |
|
990 |
(i.e. if a semaphore is signalled there)." |
|
991 |
||
992 |
"we must keep track of blocking-state if this is called nested" |
|
2302 | 993 |
(OperatingSystem blockInterrupts) ifTrue:[ |
994 |
"/ already blocked |
|
995 |
^ aBlock value |
|
996 |
]. |
|
699 | 997 |
|
2302 | 998 |
^ aBlock valueNowOrOnUnwindDo:[OperatingSystem unblockInterrupts] |
159 | 999 |
! |
1000 |
||
699 | 1001 |
waitUntilSuspended |
1002 |
"wait until the receiver is suspended." |
|
1003 |
||
1033 | 1004 |
[ |
1946
370f57e569dc
oops - race in waitUntilSuspended & waitUntilTerminated
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
1005 |
self isDead ifTrue:[^ self]. |
2262 | 1006 |
suspendSemaphore isNil ifTrue:[ |
1007 |
suspendSemaphore := Semaphore new name:'process suspend' |
|
1008 |
]. |
|
1033 | 1009 |
suspendSemaphore wait |
1010 |
] valueUninterruptably |
|
699 | 1011 |
|
1946
370f57e569dc
oops - race in waitUntilSuspended & waitUntilTerminated
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
1012 |
"Modified: 8.11.1996 / 23:05:24 / cg" |
699 | 1013 |
! |
1014 |
||
1015 |
waitUntilTerminated |
|
1016 |
"wait until the receiver is terminated. |
|
1017 |
This method allows another process to wait till the receiver finishes." |
|
1018 |
||
1033 | 1019 |
|sema| |
699 | 1020 |
|
1033 | 1021 |
[ |
1946
370f57e569dc
oops - race in waitUntilSuspended & waitUntilTerminated
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
1022 |
self isDead ifTrue:[^ self]. |
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1023 |
|
2262 | 1024 |
sema := Semaphore new name:'process termination'. |
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1025 |
self addExitAction:[sema signal]. |
1033 | 1026 |
sema wait. |
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1027 |
|
1033 | 1028 |
] valueUninterruptably |
1029 |
||
1789 | 1030 |
" |
1031 |
|p| |
|
1032 |
||
1033 |
p := [10 timesRepeat:[100 factorial]] forkAt:4. |
|
1034 |
||
1035 |
Transcript showCR:'now waiting ...'. |
|
1036 |
p waitUntilTerminated. |
|
1037 |
Transcript showCR:'done.' |
|
1038 |
" |
|
1039 |
||
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1040 |
"Modified: 12.1.1997 / 00:40:59 / cg" |
699 | 1041 |
! |
1042 |
||
1043 |
withLowerPriorityDo:aBlock |
|
1044 |
"execute aBlock at a lower priority. This can be used to perform |
|
1045 |
time-consuming operations at a more user-friendly priority." |
|
159 | 1046 |
|
699 | 1047 |
^ self withPriority:(prio - 1) do:aBlock |
1048 |
||
1049 |
" |
|
1050 |
Processor activeProcess withLowerPriorityDo:[3000 factorial] |
|
1051 |
" |
|
1052 |
! |
|
1053 |
||
1054 |
withPriority:aPrio do:aBlock |
|
1055 |
"execute aBlock at another priority. This can be used to perform |
|
1056 |
time-consuming operations at a more user-friendly priority, |
|
1057 |
or some critical action at a higher priority. Do not use too high |
|
1058 |
of a priority to avoid locking up the system (event processing takes place |
|
1059 |
at 24)" |
|
1060 |
||
1061 |
|oldprio| |
|
1062 |
||
1063 |
oldprio := prio. |
|
1064 |
self priority:aPrio. |
|
1065 |
||
1066 |
^ aBlock valueNowOrOnUnwindDo:[ |
|
1067 |
self priority:oldprio |
|
1068 |
] |
|
1069 |
||
1070 |
" |
|
1071 |
Processor activeProcess withPriority:7 do:[3000 factorial] |
|
1072 |
" |
|
1073 |
"be careful - even ^C wont work until done: |
|
1074 |
Processor activeProcess withPriority:25 do:[3000 factorial] |
|
1075 |
" |
|
202 | 1076 |
! ! |
1077 |
||
1078 |
!Process methodsFor:'startup '! |
|
116 | 1079 |
|
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1080 |
imageRestart |
699 | 1081 |
"restart the process from the beginning. |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1082 |
This is sent by the ProcessorScheduler at image restart time, |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1083 |
to all restartable processes." |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1084 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1085 |
|savedGroupId| |
699 | 1086 |
|
1087 |
"/ ('restart process ' , id printString) errorPrintNL. |
|
1088 |
||
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1089 |
savedGroupId := processGroupId. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1090 |
|
699 | 1091 |
(Processor newProcessFor:self withId:id) ifFalse:[ |
1086 | 1092 |
"for some reason, the Processor was unable to create |
1093 |
a VM process for me ...." |
|
699 | 1094 |
|
2130
b9e7e1cf98bd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1980
diff
changeset
|
1095 |
('Process [warning]: process ' , id printString , ' failed to restart.') errorPrintCR. |
1086 | 1096 |
^ nil |
699 | 1097 |
]. |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1098 |
processGroupId := savedGroupId. |
699 | 1099 |
self resume |
1086 | 1100 |
|
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1101 |
"Created: 28.10.1996 / 20:32:34 / cg" |
2130
b9e7e1cf98bd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1980
diff
changeset
|
1102 |
"Modified: 10.1.1997 / 18:01:13 / cg" |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1103 |
! |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1104 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1105 |
restart |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1106 |
"restart the process from the beginning. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1107 |
This is only possible, if its restartable." |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1108 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1109 |
restartable ifFalse:[ |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1110 |
^ self error:'process is not restartable' |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1111 |
]. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1112 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1113 |
self interruptWith:[RestartSignal raise] |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1114 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1115 |
"Modified: 12.1.1997 / 00:54:32 / cg" |
699 | 1116 |
! |
1117 |
||
116 | 1118 |
start |
159 | 1119 |
"start the process - this is sent by the VM to the process to get |
1120 |
the process up and running. |
|
329 | 1121 |
Sending #start to the process (instead of directly executing the startBlock) |
1122 |
allows more flexible handling of processes, since anything that responds |
|
1123 |
to #start can be handled transparently by the VM then ..." |
|
159 | 1124 |
|
1125 |
|block| |
|
116 | 1126 |
|
159 | 1127 |
(block := startBlock) notNil ifTrue:[ |
1475 | 1128 |
" |
1129 |
just for your convenience ... |
|
1130 |
" |
|
1131 |
name isNil ifTrue:[ |
|
1132 |
name := '(' , block displayString , ')' |
|
1133 |
]. |
|
1134 |
restartable ~~ true ifTrue:[startBlock := nil]. |
|
1839 | 1135 |
|
1136 |
[ |
|
1137 |
CoughtSignals handle:[:ex | |
|
1138 |
ex signal == RestartSignal ifTrue:[ |
|
1139 |
ex restart |
|
1140 |
]. |
|
1141 |
ex return |
|
1142 |
] do:[ |
|
1143 |
block value |
|
1144 |
] |
|
1145 |
] valueOnUnwindDo:[self terminateNoSignal]. |
|
202 | 1146 |
|
1475 | 1147 |
self terminateNoSignal. |
159 | 1148 |
] ifFalse:[ |
1475 | 1149 |
"is this artificial restriction useful ?" |
1150 |
self error:'a process cannot be started twice' |
|
116 | 1151 |
] |
1475 | 1152 |
|
1839 | 1153 |
"Modified: 28.10.1996 / 21:06:45 / cg" |
1 | 1154 |
! ! |
1155 |
||
1156 |
!Process methodsFor:'suspend / resume'! |
|
1157 |
||
699 | 1158 |
resume |
1159 |
"resume the receiver process" |
|
1160 |
||
1161 |
Processor resume:self |
|
1162 |
! |
|
1163 |
||
1164 |
resumeForSingleSend |
|
1165 |
"resume the receiver process, but only let it execute a single send." |
|
1166 |
||
1167 |
Processor resumeForSingleSend:self |
|
1168 |
! |
|
1169 |
||
326 | 1170 |
stop |
1171 |
"suspend the receiver process - will continue to run when a resume is sent. |
|
1172 |
A stopped process will not be resumed for interrupt processing." |
|
1173 |
||
1174 |
state := #stopped. |
|
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1175 |
self suspend |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1176 |
|
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1177 |
"Modified: 13.12.1995 / 13:22:58 / stefan" |
326 | 1178 |
! |
1179 |
||
1 | 1180 |
suspend |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1181 |
"suspend the receiver process - it will continue to run when a resume is sent. |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1182 |
Notice, that an interrupt will also resume the receiver, |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1183 |
so any waiting code should be prepared for premature return from |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1184 |
a suspend (see wait code in Semaphore). |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1185 |
Use #stop for a hard-suspend, which is not affected by interrupts." |
13 | 1186 |
|
1474 | 1187 |
self suspendWithState:#suspended |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1188 |
|
1474 | 1189 |
"Modified: 17.6.1996 / 14:41:34 / cg" |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1190 |
! |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1191 |
|
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1192 |
suspendWithState:aStateSymbol |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1193 |
"like suspend, this suspends the receiver process until a resume is sent. |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1194 |
This sets the state to the argument, aStateSymbol, which is shown |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1195 |
in the ProcessMonitor (instead of #suspended). |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1196 |
(i.e. no new functionality, but a bit more debuggability) |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1197 |
Notice, that an interrupt will also resume the receiver, |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1198 |
so any waiting code should be prepared for premature return from |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1199 |
a suspend (see wait code in Semaphore). |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1200 |
Use #stop for a hard-suspend, which is not affected by interrupts." |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1201 |
|
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1202 |
suspendSemaphore notNil ifTrue:[suspendSemaphore signalForAll]. |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1203 |
suspendActions notNil ifTrue:[ |
759
908363ce8a32
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
752
diff
changeset
|
1204 |
suspendActions do:[:action | action value] |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1205 |
]. |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1206 |
|
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1207 |
" |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1208 |
this is a bit of a kludge: allow someone else to |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1209 |
set the state to something like #ioWait etc. |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1210 |
In this case, do not set the receivers state to #suspend. |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1211 |
(All of this to enhance the output of the process monitor ...) |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1212 |
" |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1213 |
(state == #active or:[state == #run]) ifTrue:[ |
759
908363ce8a32
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
752
diff
changeset
|
1214 |
state := aStateSymbol. |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1215 |
]. |
1 | 1216 |
Processor suspend:self |
1217 |
! |
|
1218 |
||
1219 |
terminate |
|
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1220 |
"terminate the receiver process. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1221 |
Termination is done by raising the terminateSignal in the receiver process, |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1222 |
which can be cought. |
375 | 1223 |
All unwind actions and the exit-actions (if any) |
159 | 1224 |
will be performed before the process is really terminated." |
10 | 1225 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1226 |
self interruptWith:[ |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1227 |
Signal noHandlerSignal handle:[:ex | |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1228 |
ex return. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1229 |
] do:[ |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1230 |
TerminateSignal raise. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1231 |
]. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1232 |
self terminateNoSignal. |
159 | 1233 |
] |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1234 |
|
2158
aab75d6439d0
renamed exitAction: and suspendAction: messages - the old name
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
1235 |
"Modified: 12.1.1997 / 00:55:14 / cg" |
159 | 1236 |
! |
1237 |
||
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1238 |
terminateAllSubprocesses |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1239 |
"terminate all the receivers subprocesses and their children as well |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1240 |
(i.e. all processes in the receivers process group, except for |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1241 |
the receiver itself)." |
1531
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1242 |
|
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1243 |
ProcessorScheduler knownProcesses do:[:aProcess | |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1244 |
aProcess ~~ self ifTrue:[ |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1245 |
aProcess processGroupId == processGroupId ifTrue:[ |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1246 |
aProcess terminateWithAllSubprocesses |
1531
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1247 |
] |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1248 |
] |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1249 |
]. |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1250 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1251 |
"Modified: 28.10.1996 / 20:40:50 / cg" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1252 |
"Created: 28.10.1996 / 20:43:32 / cg" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1253 |
! |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1254 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1255 |
terminateGroup |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1256 |
"terminate the receiver with all of its created subprocesses |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1257 |
(i.e. all processes in the receivers process group)." |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1258 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1259 |
self terminateSubprocesses. |
1531
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1260 |
self terminate |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1261 |
|
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1262 |
"Created: 8.7.1996 / 14:04:15 / cg" |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1263 |
"Modified: 28.10.1996 / 20:42:00 / cg" |
1531
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1264 |
! |
2a61dad6c7ce
added #beGroupLeader & #terminateGroup
Claus Gittinger <cg@exept.de>
parents:
1530
diff
changeset
|
1265 |
|
159 | 1266 |
terminateNoSignal |
2197 | 1267 |
"hard-terminate the receiver process without sending a terminateSignal |
375 | 1268 |
or performing any unwind-handling. |
2197 | 1269 |
However, exit-actions are performed. |
1270 |
This is useful in case of emergency, when a buggy terminationHandler |
|
1271 |
prevents you from getting a process to terminate." |
|
375 | 1272 |
|
1273 |
|block| |
|
159 | 1274 |
|
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1275 |
"/ this is treated like the final suspend |
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1276 |
suspendActions notNil ifTrue:[ |
2197 | 1277 |
[suspendActions notEmpty] whileTrue:[ |
1278 |
block := suspendActions removeFirst. |
|
1279 |
block value. |
|
1280 |
] |
|
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1281 |
]. |
375 | 1282 |
exitActions notNil ifTrue:[ |
2197 | 1283 |
[exitActions notEmpty] whileTrue:[ |
1284 |
block := exitActions removeFirst. |
|
1285 |
block value. |
|
1286 |
] |
|
375 | 1287 |
]. |
329 | 1288 |
suspendSemaphore notNil ifTrue:[suspendSemaphore signalForAll]. |
159 | 1289 |
Processor terminateNoSignal:self |
752
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1290 |
|
0259dd855289
new suspendAction, Semaphore & ProcSched stuff from stefan
Claus Gittinger <cg@exept.de>
parents:
712
diff
changeset
|
1291 |
"Modified: 13.12.1995 / 13:40:14 / stefan" |
2197 | 1292 |
"Modified: 17.1.1997 / 21:57:39 / cg" |
1837
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1293 |
! |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1294 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1295 |
terminateSubprocesses |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1296 |
"terminate all the receivers subprocesses |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1297 |
(i.e. all processes in the receivers process group, except for |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1298 |
the receiver itself)." |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1299 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1300 |
ProcessorScheduler knownProcesses do:[:aProcess | |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1301 |
aProcess ~~ self ifTrue:[ |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1302 |
aProcess processGroupId == processGroupId ifTrue:[ |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1303 |
aProcess terminate |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1304 |
] |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1305 |
] |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1306 |
]. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1307 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1308 |
"Modified: 28.10.1996 / 20:40:50 / cg" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1309 |
"Created: 28.10.1996 / 20:41:49 / cg" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1310 |
! |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1311 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1312 |
terminateWithAllSubprocesses |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1313 |
"terminate the receiver with all of its created subprocesses and their children |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1314 |
(i.e. all processes in the receivers process group)." |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1315 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1316 |
self terminateAllSubprocesses. |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1317 |
self terminate |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1318 |
|
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1319 |
"Modified: 28.10.1996 / 20:42:00 / cg" |
7e3b67a1adab
more subprocess termination variants
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1320 |
"Created: 28.10.1996 / 20:44:07 / cg" |
1 | 1321 |
! ! |
1322 |
||
1784
af6446feffae
optionally pass the interruptedContext to a #interruptWith: block
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
1323 |
!Process class methodsFor:'documentation'! |
159 | 1324 |
|
699 | 1325 |
version |
2302 | 1326 |
^ '$Header: /cvs/stx/stx/libbasic/Process.st,v 1.75 1997-01-29 14:27:21 cg Exp $' |
159 | 1327 |
! ! |
699 | 1328 |
Process initialize! |