use a thread-local variable to get the current running loop

if we had a method to get the running loop, similar to how
isc_tid() gets the current thread ID, we can simplify loop
and loopmgr initialization.

remove most uses of isc_loop_current() in favor of isc_loop().
in some places where that was the only reason to pass loopmgr,
remove loopmgr from the function parameters.
This commit is contained in:
Evan Hunt
2024-03-26 00:13:45 -07:00
committed by Ondřej Surý
parent cad6292fc4
commit c47fa689d4
22 changed files with 77 additions and 79 deletions

View File

@@ -27,6 +27,16 @@ typedef void (*isc_job_cb)(void *);
ISC_LANG_BEGINDECLS
/*%<
* Returns the current running loop.
*/
extern thread_local isc_loop_t *isc__loop_local;
static inline isc_loop_t *
isc_loop(void) {
return (isc__loop_local);
}
void
isc_loopmgr_create(isc_mem_t *mctx, uint32_t nloops, isc_loopmgr_t **loopmgrp);
/*%<