262 TimeSlicingPriorityLimit := 26. |
262 TimeSlicingPriorityLimit := 26. |
263 HighestPriority := 30. |
263 HighestPriority := 30. |
264 SchedulingPriority := 31. |
264 SchedulingPriority := 31. |
265 |
265 |
266 InvalidProcessSignal isNil ifTrue:[ |
266 InvalidProcessSignal isNil ifTrue:[ |
267 InvalidProcessSignal := Error newSignalMayProceed:true. |
267 InvalidProcessSignal := Error newSignalMayProceed:true. |
268 InvalidProcessSignal nameClass:self message:#invalidProcessSignal. |
268 InvalidProcessSignal nameClass:self message:#invalidProcessSignal. |
269 InvalidProcessSignal notifierString:'invalid process'. |
269 InvalidProcessSignal notifierString:'invalid process'. |
270 ]. |
270 ]. |
271 |
271 |
272 Processor isNil ifTrue:[ |
272 Processor isNil ifTrue:[ |
273 "create the one and only processor" |
273 "create the one and only processor" |
274 |
274 |
275 Processor := self basicNew initialize. |
275 Smalltalk at:#Processor put:(self basicNew initialize). |
276 ]. |
276 ]. |
277 |
277 |
278 " |
278 " |
279 allow configurations without processes |
279 allow configurations without processes |
280 (but such configurations are no longer distributed) |
280 (but such configurations are no longer distributed) |
281 " |
281 " |
282 PureEventDriven := self threadsAvailable not. |
282 PureEventDriven := self threadsAvailable not. |
283 PureEventDriven ifTrue:[ |
283 PureEventDriven ifTrue:[ |
284 'Processor [error]: no process support - running event driven' errorPrintCR |
284 'Processor [error]: no process support - running event driven' errorPrintCR |
285 ]. |
285 ]. |
286 self initializeVMMaxProcessId |
286 self initializeVMMaxProcessId |
287 |
287 |
288 "Modified: / 23-09-1996 / 14:24:50 / stefan" |
288 "Modified: / 23-09-1996 / 14:24:50 / stefan" |
289 "Modified: / 10-01-1997 / 18:03:03 / cg" |
289 "Modified: / 10-01-1997 / 18:03:03 / cg" |
2338 |
2338 |
2339 !ProcessorScheduler methodsFor:'semaphore signalling'! |
2339 !ProcessorScheduler methodsFor:'semaphore signalling'! |
2340 |
2340 |
2341 disableFd:aFileDescriptor doSignal:doSignal |
2341 disableFd:aFileDescriptor doSignal:doSignal |
2342 "disable triggering of a semaphore for aFileDescriptor.. |
2342 "disable triggering of a semaphore for aFileDescriptor.. |
2343 If doSignal is true, the associated semaphore is signaled." |
2343 If doSignal is true, the associated semaphore is signaled. |
|
2344 Answer a collection of semaphores that haven't been signaled." |
2344 |
2345 |
2345 |idx "{ Class: SmallInteger }" |
2346 |idx "{ Class: SmallInteger }" |
2346 wasBlocked sema| |
2347 wasBlocked sema semaCollection| |
2347 |
2348 |
2348 wasBlocked := OperatingSystem blockInterrupts. |
2349 wasBlocked := OperatingSystem blockInterrupts. |
2349 useIOInterrupts ifTrue:[ |
2350 useIOInterrupts ifTrue:[ |
2350 OperatingSystem disableIOInterruptsOn:aFileDescriptor. |
2351 OperatingSystem disableIOInterruptsOn:aFileDescriptor. |
2351 ]. |
2352 ]. |
2352 |
2353 |
2353 idx := readFdArray identityIndexOf:aFileDescriptor startingAt:1. |
2354 idx := readFdArray indexOf:aFileDescriptor startingAt:1. |
2354 [idx ~~ 0] whileTrue:[ |
2355 [idx ~~ 0] whileTrue:[ |
2355 readFdArray at:idx put:nil. |
2356 readFdArray at:idx put:nil. |
2356 readCheckArray at:idx put:nil. |
2357 readCheckArray at:idx put:nil. |
2357 (sema := readSemaphoreArray at:idx) notNil ifTrue:[ |
2358 (sema := readSemaphoreArray at:idx) notNil ifTrue:[ |
2358 readSemaphoreArray at:idx put:nil. |
2359 readSemaphoreArray at:idx put:nil. |
2359 doSignal ifTrue:[ |
2360 semaCollection isNil ifTrue:[semaCollection := Set new]. |
2360 sema signalForAll. |
2361 semaCollection add:sema. |
2361 ]. |
2362 ]. |
2362 ]. |
2363 idx := readFdArray indexOf:aFileDescriptor startingAt:idx+1. |
2363 idx := readFdArray identityIndexOf:aFileDescriptor startingAt:idx+1. |
2364 ]. |
2364 ]. |
2365 idx := writeFdArray indexOf:aFileDescriptor startingAt:1. |
2365 idx := writeFdArray identityIndexOf:aFileDescriptor startingAt:1. |
|
2366 [idx ~~ 0] whileTrue:[ |
2366 [idx ~~ 0] whileTrue:[ |
2367 writeFdArray at:idx put:nil. |
2367 writeFdArray at:idx put:nil. |
2368 writeCheckArray at:idx put:nil. |
2368 writeCheckArray at:idx put:nil. |
2369 (sema := writeSemaphoreArray at:idx) notNil ifTrue:[ |
2369 (sema := writeSemaphoreArray at:idx) notNil ifTrue:[ |
2370 writeSemaphoreArray at:idx put:nil. |
2370 writeSemaphoreArray at:idx put:nil. |
2371 doSignal ifTrue:[ |
2371 semaCollection isNil ifTrue:[semaCollection := Set new]. |
2372 sema signalForAll. |
2372 semaCollection add:sema. |
2373 ]. |
2373 ]. |
2374 ]. |
2374 idx := writeFdArray indexOf:aFileDescriptor startingAt:idx+1. |
2375 idx := writeFdArray identityIndexOf:aFileDescriptor startingAt:idx+1. |
2375 ]. |
2376 ]. |
2376 idx := exceptFdArray indexOf:aFileDescriptor startingAt:1. |
2377 idx := exceptFdArray identityIndexOf:aFileDescriptor startingAt:1. |
|
2378 [idx ~~ 0] whileTrue:[ |
2377 [idx ~~ 0] whileTrue:[ |
2379 exceptFdArray at:idx put:nil. |
2378 exceptFdArray at:idx put:nil. |
2380 (sema := exceptSemaphoreArray at:idx) notNil ifTrue:[ |
2379 (sema := exceptSemaphoreArray at:idx) notNil ifTrue:[ |
2381 exceptSemaphoreArray at:idx put:nil. |
2380 exceptSemaphoreArray at:idx put:nil. |
2382 doSignal ifTrue:[ |
2381 semaCollection isNil ifTrue:[semaCollection := Set new]. |
2383 sema signalForAll. |
2382 semaCollection add:sema. |
2384 ]. |
2383 ]. |
2385 ]. |
2384 idx := exceptFdArray indexOf:aFileDescriptor startingAt:idx+1. |
2386 idx := exceptFdArray identityIndexOf:aFileDescriptor startingAt:idx+1. |
2385 ]. |
|
2386 |
|
2387 semaCollection isNil ifTrue:[ |
|
2388 semaCollection := #(). |
|
2389 ] ifFalse:[ |
|
2390 doSignal ifTrue:[ |
|
2391 semaCollection do:[:eachSema| |
|
2392 eachSema signalForAll. |
|
2393 semaCollection := #(). |
|
2394 ]. |
|
2395 ]. |
2387 ]. |
2396 ]. |
2388 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
2397 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
2398 ^ semaCollection |
2389 ! |
2399 ! |
2390 |
2400 |
2391 disableSemaphore:aSemaphore |
2401 disableSemaphore:aSemaphore |
2392 "disable triggering of a semaphore" |
2402 "disable triggering of a semaphore" |
2393 |
2403 |