-
Notifications
You must be signed in to change notification settings - Fork 1
/
task.h
30 lines (27 loc) · 880 Bytes
/
task.h
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
/* This structure describes a "task" to be run by a thread. */
typedef struct
{
void (*fn)(void *);
void (*data);
// complete with additional field if needed
} miniomp_task_t;
typedef struct
{
int max_elements;
int count;
int head;
int tail;
int first;
int lock_queue;
miniomp_task_t **queue;
// complete with additional field if needed
} miniomp_taskqueue_t;
extern miniomp_taskqueue_t * miniomp_taskqueue;
#define MAXELEMENTS_TQ 128
// funtions to implement basic management operations on taskqueue
bool is_empty(miniomp_taskqueue_t *task_queue);
bool is_full(miniomp_taskqueue_t *task_queue) ;
bool is_valid(miniomp_task_t *task_descriptor);
bool enqueue(miniomp_taskqueue_t *task_queue, miniomp_task_t *task_descriptor);
bool dequeue(miniomp_taskqueue_t *task_queue);
miniomp_task_t *first(miniomp_taskqueue_t *task_queue);