29 lines
818 B
Forth
29 lines
818 B
Forth
Block 4300
|
|
( process.4th — lifecycle phase operators )
|
|
( Event codes must match hermes/init.4th )
|
|
1 CONSTANT SPAWN-EVENT
|
|
2 CONSTANT PAUSE-EVENT
|
|
3 CONSTANT RESUME-EVENT
|
|
4 CONSTANT KILL-EVENT
|
|
( SPAWN: birth VM, notify Hermes )
|
|
: SPAWN ( c-addr u -- )
|
|
BIRTH
|
|
LOG-INFO" process: spawned"
|
|
S" 1 EVENT-EMIT" S" Hermes" VM-EXEC ;
|
|
( PAUSE: notify Hermes, send STOP to the named VM )
|
|
: PAUSE ( c-addr u -- )
|
|
S" 2 EVENT-EMIT" S" Hermes" VM-EXEC
|
|
S" STOP" 2SWAP VM-EXEC ;
|
|
Block 4301
|
|
( Lifecycle operators: resume, kill, phase )
|
|
( RESUME: notify Hermes, START the named VM )
|
|
: RESUME ( c-addr u -- )
|
|
S" 3 EVENT-EMIT" S" Hermes" VM-EXEC
|
|
LOG-INFO" process: resumed"
|
|
START ;
|
|
( KILL-VM: notify Hermes, then kill VM )
|
|
: KILL-VM ( c-addr u -- )
|
|
S" 4 EVENT-EMIT" S" Hermes" VM-EXEC
|
|
LOG-INFO" process: killed"
|
|
KILL ;
|