isc_loop() can now take its place.
This also requires changes to the test harness - instead of running the
setup and teardown outside of th main loop, we now schedule the setup
and teardown to run on the loop (via isc_loop_setup() and
isc_loop_teardown()) - this is needed because the new the isc_loop()
call has to be run on the active event loop, but previously the
isc_loop_current() (and the variants like isc_loop_main()) would work
even outside of the loop because it needed just isc_tid() to work, but
not the full loop (which was mainly true for the main thread).
NULL, NULL, ISC_NM_PROXY_NONE,
&ifp->tcplistensocket));
ifp->flags |= NS_INTERFACEFLAG_LISTENING;
- isc_async_current(loopmgr, sendquery, ifp->tcplistensocket);
+ isc_async_current(sendquery, ifp->tcplistensocket);
return;
lock_and_dumpnode(dns_fixedname_name(&fname), node);
dns_db_detachnode(gdb, &node);
- isc_async_current(loopmgr, assignwork, NULL);
+ isc_async_current(assignwork, NULL);
}
/*%
done_update(void) {
ddebug("done_update()");
- isc_async_current(loopmgr, getinput, NULL);
+ isc_async_current(getinput, NULL);
}
static void
/* NTA is expired */
dns__nta_ref(nta);
dns_ntatable_ref(nta->ntatable);
- isc_async_current(nta->ntatable->loopmgr, delete_expired, nta);
+ isc_async_current(delete_expired, nta);
goto done;
}
*\li 'cbarg' is passed to the 'cb' as the only argument, may be NULL
*/
-#define isc_async_current(loopmgr, cb, cbarg) \
- isc_async_run(isc_loop_current(loopmgr), cb, cbarg)
+#define isc_async_current(cb, cbarg) isc_async_run(isc_loop(), cb, cbarg)
/*%<
* Helper macro to run the job on the current loop
*/
*\li 'loopmgr' is a valid loop manager.
*/
-isc_loop_t *
-isc_loop_current(isc_loopmgr_t *loopmgr);
-/*%<
- * Returns the loop object from which the function has been called,
- * or NULL if not called from a loop.
- *
- * Requires:
- *\li 'loopmgr' is a valid loop manager.
- */
-
isc_loop_t *
isc_loop_get(isc_loopmgr_t *loopmgr, uint32_t tid);
/*%<
return (DEFAULT_LOOP(loopmgr));
}
-isc_loop_t *
-isc_loop_current(isc_loopmgr_t *loopmgr) {
- REQUIRE(VALID_LOOPMGR(loopmgr));
-
- return (CURRENT_LOOP(loopmgr));
-}
-
isc_loop_t *
isc_loop_get(isc_loopmgr_t *loopmgr, uint32_t tid) {
REQUIRE(VALID_LOOPMGR(loopmgr));
} \
;
-#define ISC_LOOP_TEST_CUSTOM_IMPL(name, setup, teardown) \
- void run_test_##name(void **state ISC_ATTR_UNUSED); \
- void loop_test_##name(void *arg ISC_ATTR_UNUSED); \
- void run_test_##name(void **state ISC_ATTR_UNUSED) { \
- isc_job_cb setup_loop = setup; \
- isc_job_cb teardown_loop = teardown; \
- if (setup_loop != NULL) { \
- setup_loop(state); \
- } \
- isc_loop_setup(mainloop, loop_test_##name, state); \
- isc_loopmgr_run(loopmgr); \
- if (teardown_loop != NULL) { \
- teardown_loop(state); \
- } \
- } \
+#define ISC_LOOP_TEST_CUSTOM_IMPL(name, setup, teardown) \
+ void run_test_##name(void **state ISC_ATTR_UNUSED); \
+ void loop_test_##name(void *arg ISC_ATTR_UNUSED); \
+ void run_test_##name(void **state ISC_ATTR_UNUSED) { \
+ isc_job_cb setup_loop = setup; \
+ isc_job_cb teardown_loop = teardown; \
+ if (setup_loop != NULL) { \
+ isc_loop_setup(mainloop, setup_loop, state); \
+ } \
+ if (teardown_loop != NULL) { \
+ isc_loop_teardown(mainloop, teardown_loop, state); \
+ } \
+ isc_loop_setup(mainloop, loop_test_##name, state); \
+ isc_loopmgr_run(loopmgr); \
+ } \
void loop_test_##name(void *arg ISC_ATTR_UNUSED)
#define ISC_LOOP_TEST_IMPL(name) ISC_LOOP_TEST_CUSTOM_IMPL(name, NULL, NULL)
assert_true(eresult == ISC_R_SUCCESS);
}
- isc_async_current(loopmgr, doh_connect_thread, connect_nm);
+ isc_async_current(doh_connect_thread, connect_nm);
}
if (sends <= 0) {
isc_loopmgr_shutdown(loopmgr);
static void
runjob(void *arg ISC_ATTR_UNUSED) {
- isc_async_current(loopmgr, count, loopmgr);
+ isc_async_current(count, loopmgr);
if (isc_tid() == 0) {
- isc_async_current(loopmgr, shutdown_loopmgr, loopmgr);
+ isc_async_current(shutdown_loopmgr, loopmgr);
}
}
if (have_expected_cconnects(atomic_fetch_add(&cconnects, 1) + 1)) {
do_cconnects_shutdown(loopmgr);
} else if (do_send) {
- isc_async_current(loopmgr, stream_recv_send_connect,
+ isc_async_current(stream_recv_send_connect,
(cbarg == NULL
? get_stream_connect_function()
: (stream_connect_function)cbarg));
{
do_cconnects_shutdown(loopmgr);
} else if (do_send) {
- isc_async_current(loopmgr, udp_enqueue_connect, cbarg);
+ isc_async_current(udp_enqueue_connect, cbarg);
}
isc_refcount_increment0(&active_creads);
*/
if (atomic_fetch_add(&cconnects, 1) == 0) {
assert_int_equal(eresult, ISC_R_SUCCESS);
- isc_async_current(loopmgr, udp_shutdown_connect_async_cb,
- netmgr);
+ isc_async_current(udp_shutdown_connect_async_cb, netmgr);
} else {
assert_int_equal(eresult, ISC_R_SHUTTINGDOWN);
}
* isc_nm_udpconnect() is synchronous, so we need to launch this on the
* async loop.
*/
- isc_async_current(loopmgr, udp_shutdown_connect_async_cb, netmgr);
+ isc_async_current(udp_shutdown_connect_async_cb, netmgr);
}
int
connect_readcb = timeout_retry_cb;
isc_nm_settimeouts(connect_nm, T_SOFT, T_SOFT, T_SOFT, T_SOFT);
- isc_async_current(loopmgr, stream_recv_send_connect, tcpdns_connect);
+ isc_async_current(stream_recv_send_connect, tcpdns_connect);
}
ISC_LOOP_TEST_IMPL(tcpdns_recv_one) {
start_listening(ISC_NM_LISTEN_ONE, listen_accept_cb, listen_read_cb);
- isc_async_current(loopmgr, stream_recv_send_connect, tcpdns_connect);
+ isc_async_current(stream_recv_send_connect, tcpdns_connect);
}
ISC_LOOP_TEST_IMPL(tcpdns_recv_two) {
start_listening(ISC_NM_LISTEN_ONE, listen_accept_cb, listen_read_cb);
- isc_async_current(loopmgr, stream_recv_send_connect, tcpdns_connect);
+ isc_async_current(stream_recv_send_connect, tcpdns_connect);
- isc_async_current(loopmgr, stream_recv_send_connect, tcpdns_connect);
+ isc_async_current(stream_recv_send_connect, tcpdns_connect);
}
ISC_LOOP_TEST_IMPL(tcpdns_recv_send) {
#include <tests/isc.h>
/* Set to true (or use -v option) for verbose output */
-static bool verbose = false;
+static bool verbose = true;
#define FUDGE_SECONDS 0 /* in absence of clock_getres() */
#define FUDGE_NANOSECONDS 500000000 /* in absence of clock_getres() */
*/
if (tick == 0) {
isc_timer_destroy(&tickertimer);
+ isc_loopmgr_shutdown(loopmgr);
}
}
*/
atomic_store(&startflag, true);
- isc_loopmgr_shutdown(loopmgr);
isc_timer_destroy(&oncetimer);
}