Files
integration/luprex/core/cpp/sched.hpp

41 lines
778 B
C++

#ifndef SCHED_HPP
#define SCHED_HPP
#include <cstdint>
#include <set>
class SchedEntry {
private:
friend class Schedule;
int64_t clock_;
int64_t thread_id_;
int64_t place_id_;
int func_args_;
public:
int64_t clock() const { return clock_; }
int64_t thread_id() const { return thread_id_; }
int64_t place_id() const { return place_id_; }
SchedEntry(int64_t clk, int64_t thid, int64_t plid) {
clock_ = clk;
thread_id_ = thid;
place_id_ = plid;
}
bool operator < (const SchedEntry &other) const;
};
class Schedule {
private:
std::set<SchedEntry> schedule_;
public:
void add(int64_t clk, int64_t thid, int64_t plid);
bool ready(int64_t clk) const;
SchedEntry pop();
};
#endif // SCHED_HPP