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

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

253Scheduler::requestUpdate(Channel *c)
254{
255 updateList.pushLast(c);
256 if (!inEvaluate())
257 scheduleReadyEvent();
258}
259
260void
261Scheduler::asyncRequestUpdate(Channel *c)
262{
263 std::lock_guard<std::mutex> lock(asyncListMutex);
264 asyncUpdateList.pushLast(c);
265}
266
267void
268Scheduler::scheduleReadyEvent()
269{
270 // Schedule the evaluate and update phases.
271 if (!readyEvent.scheduled()) {
272 schedule(&readyEvent);
273 if (starvationEvent.scheduled())
274 deschedule(&starvationEvent);
275 }

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

323
324 status(StatusOther);
325}
326
327void
328Scheduler::runUpdate()
329{
330 status(StatusUpdate);
331 {
332 std::lock_guard<std::mutex> lock(asyncListMutex);
333 Channel *channel;
334 while ((channel = asyncUpdateList.getNext()) != nullptr)
335 updateList.pushLast(channel);
336 }
337
338 try {
339 Channel *channel = updateList.getNext();
340 while (channel) {
341 channel->popListNode();
342 channel->update();
343 channel = updateList.getNext();
344 }

--- 195 unchanged lines hidden ---