diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-11 20:02:28 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-11 20:02:28 -0700 |
commit | b3899909d60fb6dc48cef73d6d28dbd89fe72442 (patch) | |
tree | 757be0bee9b4edb7963b57e128f9f19ca5fa1fba | |
parent | af5dae87a8a55d8606dadcedc4974b31fea97873 (diff) | |
download | mu-b3899909d60fb6dc48cef73d6d28dbd89fe72442.tar.gz |
3334
Clean up one long-standing bit of ugliness.
-rw-r--r-- | 020run.cc | 3 | ||||
-rw-r--r-- | 072scheduler.cc | 11 |
2 files changed, 6 insertions, 8 deletions
diff --git a/020run.cc b/020run.cc index 7c8f292d..e60e75ac 100644 --- a/020run.cc +++ b/020run.cc @@ -56,8 +56,7 @@ void run(recipe_ordinal r) { run_current_routine(); } -void run_current_routine() -{ // curly on a separate line, because later layers will modify function header +void run_current_routine() { while (!Current_routine->completed()) // later layers will modify condition { // Running One Instruction diff --git a/072scheduler.cc b/072scheduler.cc index cc38405b..31a65b15 100644 --- a/072scheduler.cc +++ b/072scheduler.cc @@ -16,12 +16,12 @@ def f2 [ +schedule: f2 //: first, add a deadline to run(routine) +:(before "End Globals") +int Scheduling_interval = 500; //: these changes are ugly and brittle; just close your nose and get through the next few lines -:(replace "void run_current_routine()") -void run_current_routine(int time_slice) -:(replace "while (!Current_routine->completed())" following "void run_current_routine(int time_slice)") +:(replace "while (!Current_routine->completed())" following "void run_current_routine()") int ninstrs = 0; -while (Current_routine->state == RUNNING && ninstrs < time_slice) +while (Current_routine->state == RUNNING && ninstrs < Scheduling_interval) :(after "Running One Instruction") ninstrs++; @@ -41,7 +41,6 @@ state = RUNNING; :(before "End Globals") vector<routine*> Routines; int Current_routine_index = 0; -int Scheduling_interval = 500; :(before "End Setup") Scheduling_interval = 500; Routines.clear(); @@ -60,7 +59,7 @@ void run(routine* rr) { assert(Current_routine->state == RUNNING); trace(9990, "schedule") << current_routine_label() << end(); //? cerr << "schedule: " << current_routine_label() << '\n'; - run_current_routine(Scheduling_interval); + run_current_routine(); // Scheduler State Transitions if (Current_routine->completed()) Current_routine->state = COMPLETED; |