ti = talloc_get_type_abort(array[i], module_thread_instance_t);
- if (ti->module) DEBUG4("Worker cleaning up %s thread instance data (%p/%p)", ti->module->name, ti, ti->data);
+ if (ti->mi) DEBUG4("Worker cleaning up %s thread instance data (%p/%p)",
+ ti->mi->module->name, ti, ti->data);
/*
* Check for ti->module is a hack
* and should be removed along with
* starting the instance number at 0
*/
- if (ti->module && ti->module->thread_detach) (void) ti->module->thread_detach(ti->el, ti->data);
-
+ if (ti->mi && ti->mi->module->thread_detach) ti->mi->module->thread_detach(ti->el, ti->data);
talloc_free(ti);
}
*/
int modules_thread_instantiate(TALLOC_CTX *ctx, fr_event_list_t *el)
{
- void *instance;
+ void *instance;
fr_rb_iter_inorder_t iter;
/*
MEM(ti = talloc_zero(module_thread_inst_array, module_thread_instance_t));
ti->el = el;
- ti->module = mi->module;
- ti->mod_inst = mi->dl_inst->data; /* For efficient lookups */
+ ti->mi = mi;
if (mi->module->thread_inst_size) {
MEM(ti->data = talloc_zero_array(ti, uint8_t, mi->module->thread_inst_size));
}
}
- DEBUG4("Worker alloced %s thread instance data (%p/%p)", ti->module->name, ti, ti->data);
+ DEBUG4("Worker alloced %s thread instance data (%p/%p)", ti->mi->module->name, ti, ti->data);
if (mi->module->thread_instantiate) {
if (mi->module->thread_instantiate(mi->dl_inst->conf, mi->dl_inst->data, el, ti->data) < 0) {
PERROR("Thread instantiation failed for module \"%s\"", mi->name);
fr_event_list_t *el; //!< Event list associated with this thread.
- module_t const *module; //!< Public module structure. Cached for convenience,
- ///< and to prevent use-after-free if the global data
- ///< is freed before the thread instance data.
-
- void *mod_inst; //!< Avoids thread_inst->inst->dl_inst->data.
- ///< This is in the hot path, so it makes sense.
+ module_instance_t const *mi; //!< As opposed to the thread local inst.
uint64_t total_calls; //! total number of times we've been called
uint64_t active_callers; //! number of active callers. i.e. number of current yields