diff options
| -rw-r--r-- | include/tinyff/thread/thread.h | 17 | ||||
| -rw-r--r-- | src/thread/thread.c | 12 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/tinyff/thread/thread.h b/include/tinyff/thread/thread.h index e69de29..40c09a0 100644 --- a/include/tinyff/thread/thread.h +++ b/include/tinyff/thread/thread.h @@ -0,0 +1,17 @@ +#ifdef USE_THREAD + +#ifndef TINYFF_THREAD_H +#define TINYFF_THREAD_H + +typedef void (*ff_job_cb)(void *arg); + +typedef struct { + ff_job_cb callback; + void *arg; +} ff_thread_job; + +void *ff_thread_wrapper(void *ptr); + +// Each platform must have their own bridge for running a thread job +// Like pthreads for POSIX systems +#endif diff --git a/src/thread/thread.c b/src/thread/thread.c index e69de29..524c64a 100644 --- a/src/thread/thread.c +++ b/src/thread/thread.c @@ -0,0 +1,12 @@ +#include <tinyff/thread/thread.h> + +void *thread_wrapper(void *ptr) { + ff_thread_job *job = (ff_thread_job *)ptr; + + if (job->callback) { + job->callback(job->arg); + } + + free(job); + return NULL; +} |
