scheduler.cc (13133:41d8cd260825) scheduler.cc (13140:ecd8a58f3884)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 32 unchanged lines hidden (view full) ---

41Scheduler::Scheduler() :
42 eq(nullptr), readyEvent(this, false, ReadyPriority),
43 pauseEvent(this, false, PausePriority),
44 stopEvent(this, false, StopPriority),
45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
47 _started(false), _paused(false), _stopped(false),
48 maxTickEvent(this, false, MaxTickPriority),
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 32 unchanged lines hidden (view full) ---

41Scheduler::Scheduler() :
42 eq(nullptr), readyEvent(this, false, ReadyPriority),
43 pauseEvent(this, false, PausePriority),
44 stopEvent(this, false, StopPriority),
45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
47 _started(false), _paused(false), _stopped(false),
48 maxTickEvent(this, false, MaxTickPriority),
49 _numCycles(0), _current(nullptr), initDone(false),
49 _numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
50 runOnce(false)
51{}
52
53Scheduler::~Scheduler()
54{
55 // Clear out everything that belongs to us to make sure nobody tries to
56 // clear themselves out after the scheduler goes away.
57 clear();

--- 202 unchanged lines hidden (view full) ---

260 deschedule(&readyEvent);
261 }
262}
263
264void
265Scheduler::runReady()
266{
267 bool empty = readyList.empty();
50 runOnce(false)
51{}
52
53Scheduler::~Scheduler()
54{
55 // Clear out everything that belongs to us to make sure nobody tries to
56 // clear themselves out after the scheduler goes away.
57 clear();

--- 202 unchanged lines hidden (view full) ---

260 deschedule(&readyEvent);
261 }
262}
263
264void
265Scheduler::runReady()
266{
267 bool empty = readyList.empty();
268 lastReadyTick = getCurTick();
268
269 // The evaluation phase.
270 do {
271 yield();
272 } while (!readyList.empty());
273
269
270 // The evaluation phase.
271 do {
272 yield();
273 } while (!readyList.empty());
274
274 if (!empty)
275 if (!empty) {
275 _numCycles++;
276 _numCycles++;
277 _changeStamp++;
278 }
276
277 // The update phase.
278 update();
279
280 // The delta phase.
281 for (auto &e: deltas)
282 e->run();
283 deltas.clear();

--- 45 unchanged lines hidden (view full) ---

329 scMain = Fiber::currentFiber();
330
331 _started = true;
332 _paused = false;
333 _stopped = false;
334 runToTime = run_to_time;
335
336 maxTick = max_tick;
279
280 // The update phase.
281 update();
282
283 // The delta phase.
284 for (auto &e: deltas)
285 e->run();
286 deltas.clear();

--- 45 unchanged lines hidden (view full) ---

332 scMain = Fiber::currentFiber();
333
334 _started = true;
335 _paused = false;
336 _stopped = false;
337 runToTime = run_to_time;
338
339 maxTick = max_tick;
340 lastReadyTick = getCurTick();
337
338 if (initDone) {
339 if (!runToTime && starved())
340 scheduleStarvationEvent();
341 kernel->status(::sc_core::SC_RUNNING);
342 }
343
344 schedule(&maxTickEvent, maxTick);

--- 48 unchanged lines hidden ---
341
342 if (initDone) {
343 if (!runToTime && starved())
344 scheduleStarvationEvent();
345 kernel->status(::sc_core::SC_RUNNING);
346 }
347
348 schedule(&maxTickEvent, maxTick);

--- 48 unchanged lines hidden ---