diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-25 11:05:27 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-14 11:05:54 -0500 |
commit | b2db3fb4627c8bd06489334f69b6d36d60fb418d (patch) | |
tree | 3bee765e610e678cb9aecef34ef0d171e4581362 /src/common/workqueue.h | |
parent | 4abbf13f99dac9e15856dc4e458a8c9525acab4d (diff) | |
download | tor-b2db3fb4627c8bd06489334f69b6d36d60fb418d.tar.gz tor-b2db3fb4627c8bd06489334f69b6d36d60fb418d.zip |
Documentation for new workqueue and condition and locking stuff
Diffstat (limited to 'src/common/workqueue.h')
-rw-r--r-- | src/common/workqueue.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/common/workqueue.h b/src/common/workqueue.h index 684fb192ba..dca947e915 100644 --- a/src/common/workqueue.h +++ b/src/common/workqueue.h @@ -6,15 +6,21 @@ #include "compat.h" +/** A replyqueue is used to tell the main thread about the outcome of + * work that we queued for the the workers. */ typedef struct replyqueue_s replyqueue_t; +/** A thread-pool manages starting threads and passing work to them. */ typedef struct threadpool_s threadpool_t; +/** A workqueue entry represents a request that has been passed to a thread + * pool. */ typedef struct workqueue_entry_s workqueue_entry_t; -#define WQ_CMD_RUN 0 -#define WQ_CMD_CANCEL 1 - +/** Possible return value from a work function: indicates success. */ #define WQ_RPL_REPLY 0 +/** Possible return value from a work function: indicates fatal error */ #define WQ_RPL_ERROR 1 +/** Possible return value from a work function: indicates thread is shutting + * down. */ #define WQ_RPL_SHUTDOWN 2 workqueue_entry_t *threadpool_queue_work(threadpool_t *pool, @@ -22,7 +28,7 @@ workqueue_entry_t *threadpool_queue_work(threadpool_t *pool, void (*reply_fn)(void *), void *arg); int threadpool_queue_for_all(threadpool_t *pool, - void *(*dup_fn)(void *), + void *(*dup_fn)(const void *), int (*fn)(void *, void *), void (*reply_fn)(void *), void *arg); |