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:
@@ -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);
|
||||
/*%<
|
||||
|
||||
Reference in New Issue
Block a user