aboutsummaryrefslogtreecommitdiff
path: root/src/common/workqueue.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-10-02 12:32:09 -0400
committerNick Mathewson <nickm@torproject.org>2015-01-14 11:23:34 -0500
commit1e896214e7eb5ede65663486291252b171e9daea (patch)
tree3f8d6aeb91e844888f16a2295e2200e22979a181 /src/common/workqueue.c
parentcc6529e9bb7d7e01a25b5632d6d6c2424c6fc2b4 (diff)
downloadtor-1e896214e7eb5ede65663486291252b171e9daea.tar.gz
tor-1e896214e7eb5ede65663486291252b171e9daea.zip
Refactor cpuworker to use workqueue/threadpool code.
Diffstat (limited to 'src/common/workqueue.c')
-rw-r--r--src/common/workqueue.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/workqueue.c b/src/common/workqueue.c
index 44cf98d0dc..f3ef67891d 100644
--- a/src/common/workqueue.c
+++ b/src/common/workqueue.c
@@ -108,6 +108,7 @@ workqueue_entry_free(workqueue_entry_t *ent)
{
if (!ent)
return;
+ memset(ent, 0xf0, sizeof(*ent));
tor_free(ent);
}
@@ -310,7 +311,7 @@ threadpool_queue_work(threadpool_t *pool,
*/
int
threadpool_queue_for_all(threadpool_t *pool,
- void *(*dup_fn)(const void *),
+ void *(*dup_fn)(void *),
int (*fn)(void *, void *),
void (*reply_fn)(void *),
void *arg)
@@ -444,6 +445,7 @@ replyqueue_process(replyqueue_t *queue)
workqueue_entry_t *work = TOR_TAILQ_FIRST(&queue->answers);
TOR_TAILQ_REMOVE(&queue->answers, work, next_work);
tor_mutex_release(&queue->lock);
+ work->on_thread = NULL;
work->reply_fn(work->arg);
workqueue_entry_free(work);