projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clean up header #includes
[model-checker.git]
/
threads.h
diff --git
a/threads.h
b/threads.h
index 8e0c3b054dfe7c84a92f60f0cc44ee700db00518..69bd115c4a88243657ce8f92088962f97249dccb 100644
(file)
--- a/
threads.h
+++ b/
threads.h
@@
-16,15
+16,18
@@
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 *a);
- Thread(thrd_t *t);
- int swap(Thread *t);
- void dispose();
+ ~Thread();
+ void complete();
+
+ static int swap(ucontext_t *ctxt, Thread *t);
+ static int swap(Thread *t, ucontext_t *ctxt);
thread_state get_state() { return state; }
void set_state(thread_state s) { state = s; }
thread_id_t get_id();
thread_state get_state() { return state; }
void set_state(thread_state s) { state = s; }
thread_id_t get_id();
- void set_id(thread_id_t i) { *user_thread = i; }
thrd_t get_thrd_t() { return *user_thread; }
private:
int create_context();
thrd_t get_thrd_t() { return *user_thread; }
private:
int create_context();
@@
-34,6
+37,7
@@
private:
ucontext_t context;
void *stack;
thrd_t *user_thread;
ucontext_t context;
void *stack;
thrd_t *user_thread;
+ thread_id_t id;
thread_state state;
};
thread_state state;
};