aboutsummaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-14 13:29:58 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-15 11:05:22 -0500
commita52e549124adb09ad0b49b7d2b5b3fb79bfe7aeb (patch)
treef3a05f531148dc00fc68be10d12c9ebffefb035d /src/or/cpuworker.c
parent051ad788e0ebcd0c99c1498e7e45faa71c4830c1 (diff)
downloadtor-a52e549124adb09ad0b49b7d2b5b3fb79bfe7aeb.tar.gz
tor-a52e549124adb09ad0b49b7d2b5b3fb79bfe7aeb.zip
Update workqueue implementation to use a single queue for the work
Previously I used one queue per worker; now I use one queue for everyone. The "broadcast" code is gone, replaced with an idempotent 'update' operation.
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r--src/or/cpuworker.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 36ca505fe3..3f129ded99 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -170,11 +170,6 @@ update_state_threadfn(void *state_, void *work_)
++state->generation;
return WQ_RPL_REPLY;
}
-static void
-update_state_replyfn(void *work_)
-{
- tor_free(work_);
-}
/** Called when the onion key has changed and we need to spawn new
* cpuworkers. Close all currently idle cpuworkers, and mark the last
@@ -183,11 +178,11 @@ update_state_replyfn(void *work_)
void
cpuworkers_rotate_keyinfo(void)
{
- if (threadpool_queue_for_all(threadpool,
- worker_state_new,
- update_state_threadfn,
- update_state_replyfn,
- NULL)) {
+ if (threadpool_queue_update(threadpool,
+ worker_state_new,
+ update_state_threadfn,
+ worker_state_free,
+ NULL)) {
log_warn(LD_OR, "Failed to queue key update for worker threads.");
}
}