
#ifndef PLS_LOCK_FREE_TASK_H_
#define PLS_LOCK_FREE_TASK_H_

#include "pls/internal/scheduling/base_task.h"
#include "pls/internal/data_structures/stamped_integer.h"
#include "pls/internal/scheduling/lock_free/traded_cas_field.h"

namespace pls::internal::scheduling::lock_free {

struct task : public base_task {
  task(char *stack_memory, size_t stack_size, unsigned depth, unsigned thread_id) :
      base_task(stack_memory, stack_size, depth, thread_id) {}

  // Additional info for lock-free stealing and resource trading.
  std::atomic<traded_cas_field> external_trading_deque_cas_{};
  std::atomic<base_task *> resource_stack_next_{};
  std::atomic<data_structures::stamped_integer> resource_stack_root_{{0, 0}};
};

}

#endif //PLS_LOCK_FREE_TASK_H_
