Add a REQUIRE(isc_loop() == loop) assertion to isc_work_enqueue()
to strictly enforce that work is enqueued from the loop it is
assigned to. This loudly prohibits cross-thread queue manipulation
before it inevitably turns into a concurrency debugging nightmare.
int r;
REQUIRE(VALID_LOOP(loop));
+ REQUIRE(isc_loop() == loop);
REQUIRE(work_cb != NULL);
REQUIRE(after_work_cb != NULL);
static void
work_enqueue_cb(void *arg ISC_ATTR_UNUSED) {
- isc_tid_t tid = isc_loopmgr_nloops() - 1;
-
- isc_loop_t *loop = isc_loop_get(tid);
-
- isc_work_enqueue(loop, work_cb, after_work_cb, NULL);
+ isc_work_enqueue(isc_loop(), work_cb, after_work_cb, NULL);
}
ISC_RUN_TEST_IMPL(isc_work_enqueue) {