scheduler.cc (13096:9295fa397b3f) | scheduler.cc (13133:41d8cd260825) |
---|---|
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 --- 187 unchanged lines hidden (view full) --- 196 readyList.pushFirst(p); 197 else 198 readyList.pushLast(p); 199 200 scheduleReadyEvent(); 201} 202 203void | 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 --- 187 unchanged lines hidden (view full) --- 196 readyList.pushFirst(p); 197 else 198 readyList.pushLast(p); 199 200 scheduleReadyEvent(); 201} 202 203void |
204Scheduler::resume(Process *p) 205{ 206 if (initDone) 207 ready(p); 208 else 209 initList.pushLast(p); 210} 211 212bool 213Scheduler::suspend(Process *p) 214{ 215 if (initDone) { 216 // After initialization, the only list we can be on is the ready list. 217 bool was_ready = (p->nextListNode != nullptr); 218 p->popListNode(); 219 return was_ready; 220 } else { 221 bool was_ready = false; 222 // Check the ready list to see if we find this process. 223 ListNode *n = readyList.nextListNode; 224 while (n != &readyList) { 225 if (n == p) { 226 was_ready = true; 227 break; 228 } 229 } 230 if (was_ready) 231 toFinalize.pushLast(p); 232 return was_ready; 233 } 234} 235 236void |
|
204Scheduler::requestUpdate(Channel *c) 205{ 206 updateList.pushLast(c); 207 scheduleReadyEvent(); 208} 209 210void 211Scheduler::scheduleReadyEvent() --- 148 unchanged lines hidden --- | 237Scheduler::requestUpdate(Channel *c) 238{ 239 updateList.pushLast(c); 240 scheduleReadyEvent(); 241} 242 243void 244Scheduler::scheduleReadyEvent() --- 148 unchanged lines hidden --- |