-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread.h
More file actions
36 lines (28 loc) · 754 Bytes
/
thread.h
File metadata and controls
36 lines (28 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef EX2_THREAD_H
#define EX2_THREAD_H
//================ includes =================
#include <setjmp.h>
//================ macros ===================
typedef int tid_t;
typedef void (*thread_entry_point)(void);
//================== thread declaration ===========
/**
* Class represents a thread in multi-thread programming.
*/
class Thread {
private:
tid_t id;
thread_entry_point initial_entry_point;
char* initial_sp;
int num_running_quantums;
jmp_buf env;
public:
Thread(unsigned int id, thread_entry_point entry_point);
~Thread();
void run();
tid_t get_id() const;
thread_entry_point get_init_entry_point() const;
jmp_buf &get_env();
int get_num_quantums() const;
};
#endif //EX2_THREAD_H