Skip to content
Snippets Groups Projects
threadpool.c 814 B
Newer Older
Max Barrett's avatar
Max Barrett committed
#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;
}