-
Notifications
You must be signed in to change notification settings - Fork 0
/
work_queue.h
50 lines (37 loc) · 995 Bytes
/
work_queue.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Author: Chris Wailes <chris.wailes@gmail.com>
* Project: Parallel Linear Program Solver
* Date: 2012/01/06
* Description: Definitions for the pthread workers.
*/
#ifndef WORK_QUEUE_H
#define WORK_QUEUE_H
// Standard Includes
#include <sys/types.h>
// Project Includes
#include "dictionary.h"
#include "list.h"
#include "util.h"
// Types
typedef struct {
// A list of lists.
list_t levels;
uint size;
} work_queue_t;
typedef struct {
dict_t* dict;
// Entering and leaving pairs.
list_t elp;
} work_unit_t;
// Functions
work_queue_t* work_queue_create(void);
void work_queue_destroy(work_queue_t* q);
void work_queue_free(work_queue_t* q);
void work_queue_init(work_queue_t* q);
work_queue_t* work_queue_new(void);
void work_queue_empty(work_queue_t* q);
void work_queue_add(work_queue_t* q, work_unit_t* unit);
work_unit_t* work_queue_unshift(work_queue_t* q);
work_unit_t* work_queue_pop(work_queue_t* q);
void work_unit_free(work_unit_t* unit);
#endif