-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCFS_RQ.h
More file actions
43 lines (36 loc) · 664 Bytes
/
Copy pathCFS_RQ.h
File metadata and controls
43 lines (36 loc) · 664 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
37
38
39
40
41
42
43
#ifndef CFS_RQ_H
#define CFS_RQ_H
#include <pthread.h>
#include <set>
#include <vector>
#include "task.h"
using namespace std;
struct task_compare{
bool operator() (const TASK& lhs, const TASK& rhs) const {
return lhs.v_runtime < rhs.v_runtime;
}
};
class CFS_RQ
{
public:
CFS_RQ();
//~CFS_RQ();
void lock();
void unlock();
bool empty();
int size();
void insert(TASK);
TASK pop_min();
long long get_min_v_runtime();
int get_id();
int get_v_runtime();
int get_2v_runtime();
int get_2id();
int get_3id();
int get_3v_runtime();
vector<TASK> rq_list();
private:
pthread_mutex_t mutex;
multiset<TASK, task_compare> rb_tree;
};
#endif