Deleted Added
sdiff udiff text old ( 13207:034ca389a810 ) new ( 13209:aad30faa966b )
full compact
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

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

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

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

149 initList.pushLast(p);
150 }
151}
152
153void
154Scheduler::yield()
155{
156 // Pull a process from the active list.
157 _current = getNextReady();
158 if (!_current) {
159 // There are no more processes, so return control to evaluate.
160 Fiber::primaryFiber()->run();
161 } else {
162 _current->popListNode();
163 // Switch to whatever Fiber is supposed to run this process. All
164 // Fibers which aren't running should be parked at this line.
165 _current->fiber()->run();

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

261void
262Scheduler::runReady()
263{
264 bool empty = readyListMethods.empty() && readyListThreads.empty();
265 lastReadyTick = getCurTick();
266
267 // The evaluation phase.
268 do {
269 yield();
270 } while (getNextReady());
271
272 if (!empty) {
273 _numCycles++;
274 _changeStamp++;
275 }
276
277 if (_stopNow)
278 return;
279

--- 193 unchanged lines hidden ---