model: set 'last action in thread' as an action's parent
[c11tester.git] / threads.h
index 38eac0a9cba43bc4107ee02f02eaaf4763b9595a..e52c324eb0fb81119d8063625c21387443105b18 100644 (file)
--- a/threads.h
+++ b/threads.h
@@ -2,7 +2,7 @@
 #define __THREADS_H__
 
 #include <ucontext.h>
-
+#include "mymemory.h"
 #include "libthreads.h"
 
 typedef int thread_id_t;
@@ -18,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();
 
@@ -31,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;