public:
Thread(thrd_t *t, void (*func)(), void *a);
Thread(thrd_t *t);
+ ~Thread();
+ void complete();
int swap(Thread *t);
- void dispose();
thread_state get_state() { return state; }
void set_state(thread_state s) { state = s; }
thread_id_t get_id();
- void set_id(thread_id_t i) { *user_thread = i; }
thrd_t get_thrd_t() { return *user_thread; }
private:
int create_context();
ucontext_t context;
void *stack;
thrd_t *user_thread;
+ thread_id_t id;
thread_state state;
};
-Thread *thread_current();
+Thread * thread_current();
static inline thread_id_t thrd_to_id(thrd_t t)
{