X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=threads.h;h=e52c324eb0fb81119d8063625c21387443105b18;hb=310276660b83b8dd313c512f07510268bcc1e3fc;hp=7a21a30d8d93f49e4e0c13d37dfeb18f21260b47;hpb=3cade2fadc95d3dcbc37f5e6c4da4b8e9b559c23;p=model-checker.git diff --git a/threads.h b/threads.h index 7a21a30..e52c324 100644 --- a/threads.h +++ b/threads.h @@ -2,9 +2,11 @@ #define __THREADS_H__ #include - +#include "mymemory.h" #include "libthreads.h" +typedef int thread_id_t; + #define THREAD_ID_T_NONE -1 typedef enum thread_state { @@ -16,9 +18,7 @@ typedef enum thread_state { class Thread { public: - void * operator new(size_t size); - void operator delete(void *ptr); - Thread(thrd_t *t, void (*func)(), void *a); + Thread(thrd_t *t, void (*func)(void *), void *a); ~Thread(); void complete(); @@ -29,10 +29,16 @@ public: void set_state(thread_state s) { state = s; } thread_id_t get_id(); thrd_t get_thrd_t() { return *user_thread; } + Thread * get_parent() { return parent; } + + friend void thread_startup(); + + SNAPSHOTALLOC private: int create_context(); + Thread *parent; - void (*start_routine)(); + void (*start_routine)(void *); void *arg; ucontext_t context; void *stack;