--- /dev/null
+ o Minor bugfixes (cpuworker, relay):
+ - Fix an off by one overload calculation on the number of CPUs being used by
+ our thread pool. Fixes bug 40719; bugfix on 0.3.5.1-alpha.
set_max_pending_tasks(NULL);
}
+/** Return the number of threads configured for our CPU worker. */
+unsigned int
+cpuworker_get_n_threads(void)
+{
+ if (!threadpool) {
+ return 0;
+ }
+ return threadpool_get_n_threads(threadpool);
+}
+
/** Magic numbers to make sure our cpuworker_requests don't grow any
* mis-framing bugs. */
#define CPUWORKER_REQUEST_MAGIC 0xda4afeed
const char *onionskin_type_name);
void cpuworker_cancel_circ_handshake(or_circuit_t *circ);
+unsigned int cpuworker_get_n_threads(void);
+
#endif /* !defined(TOR_CPUWORKER_H) */
/* If we've got fewer than 50 entries, we always have room for one more. */
if (ol_entries[type] < 50)
return 1;
- num_cpus = get_num_cpus(options);
+
+ /* If zero, this means our thread pool was never initialized meaning we can't
+ * really get here but make sure we don't have such value because we are
+ * using as a divisor. */
+ num_cpus = cpuworker_get_n_threads();
+ tor_assert(num_cpus > 0);
+
max_onion_queue_delay = get_onion_queue_max_delay(options);
/* Compute how many microseconds we'd expect to need to clear all
tor_mutex_release(&queue->lock);
}
+
+/** Return the number of threads configured for the given pool. */
+unsigned int
+threadpool_get_n_threads(threadpool_t *tp)
+{
+ tor_assert(tp);
+ return tp->n_threads;
+}
int threadpool_register_reply_event(threadpool_t *tp,
void (*cb)(threadpool_t *tp));
+unsigned int threadpool_get_n_threads(threadpool_t *tp);
#endif /* !defined(TOR_WORKQUEUE_H) */