6 #include "libthreads.h"
8 typedef int thread_id_t;
10 #define THREAD_ID_T_NONE -1
12 typedef enum thread_state {
23 Thread(thrd_t *t, void (*func)(void *), void *a);
27 static int swap(ucontext_t *ctxt, Thread *t);
28 static int swap(Thread *t, ucontext_t *ctxt);
30 thread_state get_state() { return state; }
31 void set_state(thread_state s) { state = s; }
33 thrd_t get_thrd_t() { return *user_thread; }
34 Thread * get_parent() { return parent; }
36 void set_creation(ModelAction *act) { creation = act; }
37 ModelAction * get_creation() { return creation; }
39 friend void thread_startup();
45 ModelAction *creation;
47 void (*start_routine)(void *);
56 Thread * thread_current();
58 static inline thread_id_t thrd_to_id(thrd_t t)
63 static inline thread_id_t int_to_id(int i)
68 static inline int id_to_int(thread_id_t id)
73 #endif /* __THREADS_H__ */