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

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

27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_CORE_SCHEDULER_HH__
31#define __SYSTEMC_CORE_SCHEDULER_HH__
32
33#include <functional>
34#include <map>
35#include <mutex>
36#include <set>
37#include <vector>
38
39#include "base/logging.hh"
40#include "sim/core.hh"
41#include "sim/eventq.hh"
42#include "systemc/core/channel.hh"
43#include "systemc/core/list.hh"

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

187 void resume(Process *p);
188
189 // Remove a process from the ready/init list if it was on one of them, and
190 // return if it was.
191 bool suspend(Process *p);
192
193 // Schedule an update for a given channel.
194 void requestUpdate(Channel *c);
195 // Same as above, but may be called from a different thread.
196 void asyncRequestUpdate(Channel *c);
197
198 // Run the given process immediately, preempting whatever may be running.
199 void
200 runNow(Process *p)
201 {
202 // This function may put a process on the wrong list, ie a thread
203 // the method list. That's fine since that's just a performance
204 // optimization, and the important thing here is how the processes are

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

479
480 ProcessList initList;
481
482 ProcessList readyListMethods;
483 ProcessList readyListThreads;
484
485 ChannelList updateList;
486
487 ChannelList asyncUpdateList;
488 std::mutex asyncListMutex;
489
490 std::map<::Event *, Tick> eventsToSchedule;
491
492 std::set<TraceFile *> traceFiles;
493
494 void trace(bool delta);
495};
496
497extern Scheduler scheduler;

--- 30 unchanged lines hidden ---