summaryrefslogtreecommitdiffstats
path: root/misc/dispatch.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-23 20:37:57 +0200
committerwm4 <wm4@nowhere>2014-04-23 21:16:51 +0200
commit2b26517ef705c4043419e2e70dacd7760af1137e (patch)
treedf04daafcbc47dd91a35b9404b4d8bd1e9373609 /misc/dispatch.h
parentac1a21e488f1c6fb4963b40e0ea2da3d523c45ba (diff)
downloadmpv-2b26517ef705c4043419e2e70dacd7760af1137e.tar.bz2
mpv-2b26517ef705c4043419e2e70dacd7760af1137e.tar.xz
dispatch: move into its own source file
This was part of osdep/threads.c out of laziness. But it doesn't contain anything OS dependent. Note that the rest of threads.c actually isn't all that OS dependent either (just some minor ifdeffery to work around the lack of clock_gettime() on OSX).
Diffstat (limited to 'misc/dispatch.h')
-rw-r--r--misc/dispatch.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/misc/dispatch.h b/misc/dispatch.h
new file mode 100644
index 0000000000..96a5d7cf4b
--- /dev/null
+++ b/misc/dispatch.h
@@ -0,0 +1,23 @@
+#ifndef MP_DISPATCH_H_
+#define MP_DISPATCH_H_
+
+typedef void (*mp_dispatch_fn)(void *data);
+struct mp_dispatch_queue;
+
+struct mp_dispatch_queue *mp_dispatch_create(void *talloc_parent);
+void mp_dispatch_set_wakeup_fn(struct mp_dispatch_queue *queue,
+ void (*wakeup_fn)(void *wakeup_ctx),
+ void *wakeup_ctx);
+void mp_dispatch_enqueue(struct mp_dispatch_queue *queue,
+ mp_dispatch_fn fn, void *fn_data);
+void mp_dispatch_enqueue_autofree(struct mp_dispatch_queue *queue,
+ mp_dispatch_fn fn, void *fn_data);
+void mp_dispatch_run(struct mp_dispatch_queue *queue,
+ mp_dispatch_fn fn, void *fn_data);
+void mp_dispatch_queue_process(struct mp_dispatch_queue *queue, double timeout);
+void mp_dispatch_suspend(struct mp_dispatch_queue *queue);
+void mp_dispatch_resume(struct mp_dispatch_queue *queue);
+void mp_dispatch_lock(struct mp_dispatch_queue *queue);
+void mp_dispatch_unlock(struct mp_dispatch_queue *queue);
+
+#endif