Commit 2eb9674a by FritzFlorian

Add struct for unique task id type.

parent ea24f5c2
......@@ -10,12 +10,23 @@ namespace pls {
namespace internal {
namespace scheduling {
class abstract_task {
struct id {
uint32_t id_;
bool auto_generated_;
explicit id(uint32_t id, bool auto_generated=true): id_{id}, auto_generated_{auto_generated} {};
bool operator==(const abstract_task::id& other) const {
return id_ == other.id_ && auto_generated_ == other.auto_generated_;
}
};
int depth_;
int unique_id_;
abstract_task::id unique_id_;
abstract_task* child_task_;
public:
abstract_task(int depth, int unique_id):
abstract_task(int depth, abstract_task::id unique_id):
depth_{depth},
unique_id_{unique_id},
child_task_{nullptr} {}
......@@ -25,7 +36,7 @@ namespace pls {
abstract_task* child() { return child_task_; }
void set_depth(int depth) { depth_ = depth; }
int depth() { return depth_; }
int depth() const { return depth_; }
protected:
virtual bool internal_stealing(abstract_task* other_task) = 0;
virtual bool split_task(base::spin_lock* lock) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment