62 , scheduleInProgress(false)
69 auto copy = syncPoints;
70 for (
auto& s : copy) {
71 s.getDevice()->schedulerDeleted();
74 assert(syncPoints.empty());
80 assert(time >= scheduleTime);
83 auto it = std::upper_bound(syncPoints.begin(), syncPoints.end(), time,
87 if (!scheduleInProgress && cpu) {
98 copy_if(syncPoints.begin(), syncPoints.end(), back_inserter(result),
99 FindSchedulable(device));
103 bool Scheduler::removeSyncPoint(
Schedulable& device,
int userData)
106 auto it = find_if(syncPoints.begin(), syncPoints.end(),
107 EqualSchedulable(device, userData));
108 if (it != syncPoints.end()) {
109 syncPoints.erase(it);
116 void Scheduler::removeSyncPoints(
Schedulable& device)
119 syncPoints.erase(remove_if(syncPoints.begin(), syncPoints.end(),
120 FindSchedulable(device)),
124 bool Scheduler::pendingSyncPoint(
const Schedulable& device,
int userData)
const
127 return find_if(syncPoints.begin(), syncPoints.end(),
128 EqualSchedulable(device, userData)) != syncPoints.end();
139 assert(!scheduleInProgress);
140 scheduleInProgress =
true;
143 const auto& sp = syncPoints.front();
149 assert(scheduleTime <= time);
154 int userData = sp.getUserData();
156 syncPoints.erase(syncPoints.begin());
158 device->executeUntil(time, userData);
160 scheduleInProgress =
false;
166 template <
typename Archive>
173 ar.serialize(
"time", timeStamp);
174 ar.serialize(
"type", userData);
178 template <
typename Archive>
181 ar.serialize(
"currentTime", scheduleTime);