-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.h
37 lines (27 loc) · 695 Bytes
/
worker.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
/*
* Author: Chris Wailes <chris.wailes@gmail.com>
* Project: Parallel Linear Program Solver
* Date: 2012/01/06
* Description: Definitions for the pthread workers.
*/
#ifndef WORKER_H
#define WORKER_H
// Standard Includes
#include <pthread.h>
#include <sys/types.h>
// Project Includes
#include "dictionary.h"
#include "work_queue.h"
typedef struct {
long id;
pthread_t thread;
pthread_mutex_t lock;
work_queue_t work;
} worker_t;
work_unit_t* build_work_unit(dict_t* dict);
void* worker_body(void* arg);
void worker_init(worker_t* worker, long id;);
work_unit_t* worker_steal(worker_t* self);
dict_t* workers_manager(dict_t* dict);
void workers_setup(void);
#endif