diff --git a/lib/isc/work.c b/lib/isc/work.c index 4391b2d2fa..0b7cdf5743 100644 --- a/lib/isc/work.c +++ b/lib/isc/work.c @@ -58,6 +58,7 @@ isc_work_enqueue(isc_loop_t *loop, isc_work_cb work_cb, int r; REQUIRE(VALID_LOOP(loop)); + REQUIRE(isc_loop() == loop); REQUIRE(work_cb != NULL); REQUIRE(after_work_cb != NULL); diff --git a/tests/isc/work_test.c b/tests/isc/work_test.c index 3c126ee613..5e0184cd52 100644 --- a/tests/isc/work_test.c +++ b/tests/isc/work_test.c @@ -56,13 +56,8 @@ after_work_cb(void *arg) { } static void -work_enqueue_cb(void *arg) { - UNUSED(arg); - uint32_t tid = isc_loopmgr_nloops(loopmgr) - 1; - - isc_loop_t *loop = isc_loop_get(loopmgr, tid); - - isc_work_enqueue(loop, work_cb, after_work_cb, loopmgr); +work_enqueue_cb(void *arg ISC_ATTR_UNUSED) { + isc_work_enqueue(isc_loop(), work_cb, after_work_cb, NULL); } ISC_RUN_TEST_IMPL(isc_work_enqueue) {