6 #include "libthreads.h"
8 #define THREAD_ID_T_NONE -1
10 typedef enum thread_state {
19 void * operator new(size_t size);
20 void operator delete(void *ptr);
21 Thread(thrd_t *t, void (*func)(), void *a);
25 static int swap(ucontext_t *ctxt, Thread *t);
26 static int swap(Thread *t, ucontext_t *ctxt);
28 thread_state get_state() { return state; }
29 void set_state(thread_state s) { state = s; }
31 thrd_t get_thrd_t() { return *user_thread; }
35 void (*start_routine)();
44 Thread * thread_current();
46 static inline thread_id_t thrd_to_id(thrd_t t)
51 static inline thread_id_t int_to_id(int i)
56 static inline int id_to_int(thread_id_t id)
61 #endif /* __THREADS_H__ */