diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2011-12-26 21:21:12 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2011-12-26 21:21:12 -0800 |
commit | 74a1d70b8a713db1c56b0e521e7e62dbda7e7a37 (patch) | |
tree | 7f3b866ddf14ea312b09d7668641e19265ce8699 /iothread.h | |
parent | 165a5aaa83d40079cb4fcc1e76fda4b1ed1f993e (diff) |
Added iothread
Diffstat (limited to 'iothread.h')
-rw-r--r-- | iothread.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/iothread.h b/iothread.h new file mode 100644 index 00000000..a4246fa4 --- /dev/null +++ b/iothread.h @@ -0,0 +1,30 @@ +/** \file iothread.h + Handles IO that may hang. +*/ + +#ifndef FISH_IOTHREAD_H +#define FISH_IOTHREAD_H + +/** + Runs a command on a thread. + + \param handler The function to execute on a background thread. Accepts an arbitrary context pointer, and returns an int, which is passed to the completionCallback. + \param completionCallback The function to execute on the main thread once the background thread is complete. Accepts an int (the return value of handler) and the context. + \param context A arbitary context pointer to pass to the handler and completion callback. + \return A sequence number, currently not very useful. +*/ +int iothread_perform(int (*handler)(void *), void (*completionCallback)(void *, int), void *context); + +/** + Gets the fd on which to listen for completion callbacks. + + \return A file descriptor on which to listen for completion callbacks. +*/ +int iothread_port(void); + +/** + Services one iothread competion callback. +*/ +void iothread_service_completion(void); + +#endif |