Newer
Older
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
#include "threadpool.h"
#include "list.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
struct thread_pool {
pthread_mutex_t m;
struct list global_queue;
bool shutdown;
};
struct future {
fork_join_task_t task;
void* args;
void* result;
};
struct thread_pool * thread_pool_new(int nthreads) {
struct thread_pool *threads = malloc(sizeof(struct thread_pool));
return threads;
}
void thread_pool_shutdown_and_destroy(struct thread_pool *threadpool) {
return;
}
void * future_get(struct future *future) {
return future;
}
void future_free(struct future *future) {
return;
}
struct future * thread_pool_submit(struct thread_pool *pool, fork_join_task_t task, void * data) {
struct future *future = malloc(sizeof(struct future));
return future;
}