more process management code

This commit is contained in:
hyunghwan.chung 2019-09-07 18:15:20 +00:00
parent 4d6cd7840a
commit ff99686c97
2 changed files with 15 additions and 1 deletions

View File

@ -167,6 +167,9 @@ class System(Apex)
3 -> application main
the following loops starts from pid 3 up to 100. this is POC only. i need to write a proper enumeration methods and use them.
*/
//Processor _suspendAllUserProcesses. <--- keep kernel processes alive.
pid := 3.
while (pid < 100)
{
@ -381,6 +384,7 @@ TODO: how to pass all variadic arguments to another variadic methods???
}
// TODO: support Pointer arithmetic?
class(#limited) SmallPointer(Object)
{
method(#primitive) asString.

View File

@ -2786,6 +2786,15 @@ static moo_pfrc_t pf_process_scheduler_process_by_id (moo_t* moo, moo_mod_t* mod
return MOO_PF_FAILURE;
}
static moo_pfrc_t pf_process_scheduler_suspend_all_user_processes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
{
/* TODO: must exclude special inner processes */
while (moo->processor->runnable.first)
{
suspend_process (moo, moo->processor->runnable.first);
}
}
/* ------------------------------------------------------------------ */
static moo_pfrc_t pf_semaphore_signal (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
{
@ -4318,7 +4327,8 @@ static pf_t pftab[] =
{ "MethodContext_findExceptionHandler:", { pf_context_find_exception_handler, 1, 1 } },
{ "MethodContext_goto:", { pf_context_goto, 1, 1 } },
{ "ProcessScheduler_processById:", { pf_process_scheduler_process_by_id, 1, 1 } },
{ "ProcessScheduler_processById:", { pf_process_scheduler_process_by_id, 1, 1 } },
{ "ProcessScheduler_suspendAllUserProcesses", { pf_process_scheduler_suspend_all_user_processes, 0, 0 } },
{ "Process_resume", { pf_process_resume, 0, 0 } },
{ "Process_sp", { pf_process_sp, 0, 0 } },