diff options
Diffstat (limited to 'src/systemc/core/scheduler.cc')
-rw-r--r-- | src/systemc/core/scheduler.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 46053b40f..9b431acba 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -201,6 +201,39 @@ Scheduler::ready(Process *p) } void +Scheduler::resume(Process *p) +{ + if (initDone) + ready(p); + else + initList.pushLast(p); +} + +bool +Scheduler::suspend(Process *p) +{ + if (initDone) { + // After initialization, the only list we can be on is the ready list. + bool was_ready = (p->nextListNode != nullptr); + p->popListNode(); + return was_ready; + } else { + bool was_ready = false; + // Check the ready list to see if we find this process. + ListNode *n = readyList.nextListNode; + while (n != &readyList) { + if (n == p) { + was_ready = true; + break; + } + } + if (was_ready) + toFinalize.pushLast(p); + return was_ready; + } +} + +void Scheduler::requestUpdate(Channel *c) { updateList.pushLast(c); |