summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bridges/pthread/thread_bridge.c11
-rw-r--r--src/thread/thread.c10
2 files changed, 18 insertions, 3 deletions
diff --git a/src/bridges/pthread/thread_bridge.c b/src/bridges/pthread/thread_bridge.c
new file mode 100644
index 0000000..e014a3a
--- /dev/null
+++ b/src/bridges/pthread/thread_bridge.c
@@ -0,0 +1,11 @@
+#ifdef USE_THREAD
+
+#include <bridges/pthread/thread_bridge.h>
+
+pthread_t run_job_in_thread(ff_thread_job *job) {
+ pthread_t thread;
+ pthread_create(&thread, NULL, ff_thread_wrapper, job);
+ return thread;
+}
+
+#endif \ No newline at end of file
diff --git a/src/thread/thread.c b/src/thread/thread.c
index 524c64a..d8ba05b 100644
--- a/src/thread/thread.c
+++ b/src/thread/thread.c
@@ -1,12 +1,16 @@
+#ifdef USE_THREAD
+
#include <tinyff/thread/thread.h>
-void *thread_wrapper(void *ptr) {
+void *ff_thread_wrapper(void *ptr) {
ff_thread_job *job = (ff_thread_job *)ptr;
-
+
if (job->callback) {
job->callback(job->arg);
}
- free(job);
+ job->ctx->allocator.ff_free(job);
return NULL;
}
+
+#endif \ No newline at end of file