void
isc_task_sendto(isc_task_t *task, isc_event_t **eventp, int c);
/*%<
- * Send '*event' to 'task'.
+ * Send '*event' to 'task', if task is idle try starting it on cpu 'c'
+ * If 'c' is smaller than 0 then cpu is selected randomly.
*
* Requires:
*
isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp);
/*%<
* Send '*event' to '*taskp' and then detach '*taskp' from its
- * task.
+ * task. If task is idle try starting it on cpu 'c'
+ * If 'c' is smaller than 0 then cpu is selected randomly.
*
* Requires:
*
*/
REQUIRE(VALID_TASK(task));
+ XTRACE("isc_task_send");
- if (c == -1) {
+ if (c < 0) {
c = atomic_fetch_add_explicit(&task->manager->curq, 1,
- memory_order_relaxed)
- % task->manager->workers;
+ memory_order_relaxed);
}
-
- XTRACE("isc_task_send");
+ c %= task->manager->workers;
/*
* We're trying hard to hold locks for as short a time as possible.
REQUIRE(taskp != NULL);
task = (isc__task_t *)*taskp;
REQUIRE(VALID_TASK(task));
- if (c == -1) {
+ XTRACE("isc_task_sendanddetach");
+
+ if (c < 0) {
c = atomic_fetch_add_explicit(&task->manager->curq, 1,
- memory_order_relaxed)
- % task->manager->workers;
+ memory_order_relaxed);
}
+ c %= task->manager->workers;
- XTRACE("isc_task_sendanddetach");
LOCK(&task->lock);
idle1 = task_send(task, eventp, c);
idle2 = task_detach(task);