about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-11 20:02:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-11 20:02:28 -0700
commitb3899909d60fb6dc48cef73d6d28dbd89fe72442 (patch)
tree757be0bee9b4edb7963b57e128f9f19ca5fa1fba
parentaf5dae87a8a55d8606dadcedc4974b31fea97873 (diff)
downloadmu-b3899909d60fb6dc48cef73d6d28dbd89fe72442.tar.gz
3334
Clean up one long-standing bit of ugliness.
-rw-r--r--020run.cc3
-rw-r--r--072scheduler.cc11
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;
='n215' href='#n215'>215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385