some cosmetic changes in kernel/System.moo

This commit is contained in:
hyunghwan.chung 2019-11-06 06:13:00 +00:00
parent 0967d0d937
commit 7929c0ab3c

View File

@ -117,7 +117,7 @@ class System(Apex)
if (tmp respondsTo: #finalize) if (tmp respondsTo: #finalize)
{ {
// finalize is protected with an exception handler. // finalize is protected with an exception handler.
// the exception is ignored except it's logged. // the exception is ignored except it is logged.
[ tmp finalize ] on: Exception do: [:ex | System longNl: "Exception in finalize - " & ex messageText ] [ tmp finalize ] on: Exception do: [:ex | System longNl: "Exception in finalize - " & ex messageText ]
}. }.
}. }.
@ -147,7 +147,7 @@ class System(Apex)
] ensure: [ ] ensure: [
self.gcfin_sem signal. // in case the process is stuck in wait. self.gcfin_sem signal. // in case the process is stuck in wait.
self.gcfin_sem unsignal. self.gcfin_sem unsignal.
System logNl: 'End of GC finalization process ' & (thisProcess id) asString. System logNl: "End of GC finalization process " & (thisProcess id) asString.
]. ].
} }
@ -166,7 +166,7 @@ class System(Apex)
// TODO: Do i have to protected this in an exception handler??? // TODO: Do i have to protected this in an exception handler???
//TODO: Execute Handler for signo. //TODO: Execute Handler for signo.
System logNl: 'Interrupt dectected - signal no - ' & signo asString. System logNl: "Interrupt dectected - signal no - " & signo asString.
// user-defined signal handler is not allowed for 16rFF // user-defined signal handler is not allowed for 16rFF
if (signo == 16rFF) { goto done }. if (signo == 16rFF) { goto done }.
@ -201,14 +201,15 @@ class System(Apex)
oldps := self _toggleProcessSwitching: false. oldps := self _toggleProcessSwitching: false.
/* /*
0 -> startup <--- this should also be stored in the 'caller' variable. 0 -> startup <--- this should also be stored in the "caller" variable.
1 -> __gc_finalizer 1 -> __gc_finalizer
2 -> __os_sig_handler 2 -> __os_sig_handler
3 .. -> other processes started by application. 3 .. -> other processes started by application.
from the second run onwards, the starting pid may not be 0.
*/ */
/* TODO: this loop is error-prone as it can't handle when the processs id wraps back and the id of gcfin_proc and ossig_proc gets bigger than normal child processes */
//proc := System _findNextProcess: self.ossig_pid. //proc := System _findNextProcess: self.ossig_pid.
proc := System _findNextProcess: -1. proc := System _findFirstProcess.
while (proc notError) while (proc notError)
{ {
pid := proc id. pid := proc id.
@ -220,11 +221,11 @@ class System(Apex)
proc := System _findNextProcess: pid. proc := System _findNextProcess: pid.
}. }.
System logNl: 'Requesting to terminate the caller process of id ' & (caller id) asString. System logNl: "Requesting to terminate the caller process of id " & (caller id) asString.
caller terminate. // terminate the startup process. caller terminate. // terminate the startup process.
self _toggleProcessSwitching: oldps. self _toggleProcessSwitching: oldps.
System logNl: '>>>>End of OS signal handler process ' & (thisProcess id) asString. System logNl: ">>>>End of OS signal handler process " & (thisProcess id) asString.
self.gcfin_should_exit := true. self.gcfin_should_exit := true.
self.gcfin_sem signal. // wake the gcfin process. self.gcfin_sem signal. // wake the gcfin process.