projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clockvector: add print() method
[model-checker.git]
/
threads.h
diff --git
a/threads.h
b/threads.h
index 7a21a30d8d93f49e4e0c13d37dfeb18f21260b47..e52c324eb0fb81119d8063625c21387443105b18 100644
(file)
--- a/
threads.h
+++ b/
threads.h
@@
-2,9
+2,11
@@
#define __THREADS_H__
#include <ucontext.h>
#define __THREADS_H__
#include <ucontext.h>
-
+#include "mymemory.h"
#include "libthreads.h"
#include "libthreads.h"
+typedef int thread_id_t;
+
#define THREAD_ID_T_NONE -1
typedef enum thread_state {
#define THREAD_ID_T_NONE -1
typedef enum thread_state {
@@
-16,9
+18,7
@@
typedef enum thread_state {
class Thread {
public:
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();
~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; }
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();
private:
int create_context();
+ Thread *parent;
- void (*start_routine)();
+ void (*start_routine)(
void *
);
void *arg;
ucontext_t context;
void *stack;
void *arg;
ucontext_t context;
void *stack;