#define pair_make_config(_a, _b, _c) fr_pair_make(request, &request->control, _a, _b, _c)
/* threads.c */
-int thread_pool_bootstrap(CONF_SECTION *cs, bool *spawn_workers);
-int thread_pool_init(void);
-void thread_pool_stop(void);
+fr_event_list_t *thread_event_list(void);
+int thread_pool_bootstrap(CONF_SECTION *cs, bool *spawn_workers);
+int thread_pool_init(void);
+void thread_pool_stop(void);
/*
* In threads.c
* These should ONLY be called where __Thread_local is a pointer to heap
* allocated memory that needs to be freed on thread exit.
*
- * For other types like ints __Thread_local should be used directly
+ * For other types like ints _Thread_local should be used directly
* without the macros.
*/
#ifndef HAVE_PTHREAD_H
} fr_pps_t;
#endif
+/** Holds this thread's event_list
+ *
+ * Some modules need direct access to the event_list, so they can
+ * insert events that fire independently of processing requests.
+ *
+ * Libcurl is a good example of this, where it manages its own timers
+ * for IO events, and needs to be awoken, when a timeout expires.
+ */
+static _Thread_local fr_event_list_t *el;
/*
* A data structure to manage the thread pool. There's no real
#endif
}
+/** Return this thread's event list
+ *
+ * Can be used by modules to get the event_list for the current thread,
+ * so that they can add their own timers outside of request processing.
+ *
+ * @return This thread's fr_event_list_t.
+ */
+fr_event_list_t *thread_event_list(void)
+{
+ return el;
+}
+
/*
* The main thread handler for requests.
*
int rcode;
THREAD_HANDLE *thread = talloc_get_type_abort(arg, THREAD_HANDLE);
TALLOC_CTX *ctx;
- fr_event_list_t *el;
fr_heap_t *local_backlog;
#ifdef HAVE_GPERFTOOLS_PROFILER_H