ProcessorScheduler.st
changeset 20763 b1e9ec00e8af
parent 20760 dcfd225589c4
child 20810 86f0131cd99a
equal deleted inserted replaced
20762:e2a745bdd401 20763:b1e9ec00e8af
   840     |dispatchAction handlerAction ignoredSignals|
   840     |dispatchAction handlerAction ignoredSignals|
   841 
   841 
   842     "avoid confusion if entered twice"
   842     "avoid confusion if entered twice"
   843 
   843 
   844     dispatching == true ifTrue:[
   844     dispatching == true ifTrue:[
   845 	'Processor [info]: already in dispatch' infoPrintCR.
   845         'Processor [info]: already in dispatch' infoPrintCR.
   846 	^ self
   846         ^ self
   847     ].
   847     ].
   848     dispatching := true.
   848     dispatching := true.
   849 
   849 
   850     "/ create the relevant blocks & signalSet outside of the
   850     "/ create the relevant blocks & signalSet outside of the
   851     "/ while-loop
   851     "/ while-loop
   852     "/ (thanks to stefans objectAllocation monitor,
   852     "/ (thanks to stefans objectAllocation monitor,
   853     "/  this safes a bit of memory allocation in the scheduler)
   853     "/  this safes a bit of memory allocation in the scheduler)
   854 
   854 
   855     dispatchAction := [ [dispatching] whileTrue:[ self dispatch ] ].
   855     dispatchAction := 
   856 
   856         [ 
   857     handlerAction := [:ex |
   857             [dispatching] whileTrue:[ 
   858 			(HaltInterrupt accepts:ex creator) ifTrue:[
   858                 self dispatch 
   859 			    "/ in a standalone application, we do not want those
   859             ] 
   860 			    Smalltalk isStandAloneApp ifTrue:[
   860         ].
   861 				Smalltalk isStandAloneDebug ifFalse:[
   861 
   862 				    ('Processor [info]: ignored (', ex creator printString, ')') infoPrintCR.
   862     handlerAction := 
   863 				    ex proceed.
   863         [:ex |
   864 				]
   864             (HaltInterrupt accepts:ex creator) ifTrue:[
   865 			    ].
   865                 "/ in a standalone application, we do not want those
   866 			].
   866                 Smalltalk isStandAloneApp ifTrue:[
   867 
   867                     Smalltalk isStandAloneDebug ifFalse:[
   868 			('Processor [info]: caught (and ignored) signal (', ex creator printString, ')') infoPrintCR.
   868                         ('Processor [info]: ignored (', ex creator printString, ')') infoPrintCR.
   869 			ex return
   869                         ex proceed.
   870 		     ].
   870                     ]
       
   871                 ].
       
   872             ].
       
   873 
       
   874             ('Processor [info]: caught (and ignored) signal (', ex creator printString, ')') infoPrintCR.
       
   875             ex return
       
   876          ].
   871 
   877 
   872     ignoredSignals := SignalSet
   878     ignoredSignals := SignalSet
   873 			with:HaltInterrupt
   879                         with:HaltInterrupt
   874 			with:TerminateProcessRequest
   880                         with:TerminateProcessRequest
   875 			with:RecursionError
   881                         with:RecursionError
   876 			with:AbortAllOperationRequest.
   882                         with:AbortAllOperationRequest.
   877 
   883 
   878     "/
   884     "/
   879     "/ I made this an extra call to dispatch; this allows recompilation
   885     "/ I made this an extra call to dispatch; this allows recompilation
   880     "/  of the dispatch-handling code in the running system.
   886     "/  of the dispatch-handling code in the running system.
   881     "/
   887     "/
   882     [dispatching] whileTrue:[
   888     [dispatching] whileTrue:[
   883 	ignoredSignals handle:handlerAction do:dispatchAction
   889         ignoredSignals 
       
   890             handle:handlerAction 
       
   891             do:dispatchAction
   884     ].
   892     ].
   885 
   893 
   886     "/ we arrive here in standalone Apps,
   894     "/ we arrive here in standalone Apps,
   887     "/ when the last process at or above UserSchedulingPriority process died.
   895     "/ when the last process at or above UserSchedulingPriority process died.
   888     "/ regular ST/X stays in above loop forever
   896     "/ regular ST/X stays in above loop forever