lib: replace trace is_static with destruction listeners
General idea
------------
Replace bt_trace is_static infrastructure with the concept of
destruction listener and extend it for the bt_trace_class object.
This allows for downstream components to ask to be notify of the
destruction of those objects. This notification is useful for component
that keep data related trace IR objects that should be deallocated when
the trace and/or trace class are destroyed.
This feature is mostly useful to handle sources which could create and
release lots of trace class and trace objects. In this case, when the
source message iterator is done with the stream objects (emitted all the
relevant stream end messages), it puts the stream, trace, and trace
class references. Then downstream users are notified that specific
external objects are about to be destroyed, so they release/close any
associated resource.
The flt.lttng-utils.debug-info component will make use of this
capability to cleanup the mapping between input and output objects it
needs to manage to do its function.
Implementation
--------------
Both trace class and trace offer the same interface and are implemented
in the exact same way.
Destruction listener callbacks and their associated private pointer are
stored in an array and are all called at the execution of the destroy
functions. Destruction listeners are registered using the following
functions:
bt_trace_status bt_trace_add_destruction_listener(
const bt_trace *trace,
bt_trace_destruction_listener_func listener,
void *data,
uint64_t *listener_id);
bt_trace_class_status bt_trace_class_add_destruction_listener(
const bt_trace_class *trace,
bt_trace_class_destruction_listener_func listener,
void *data,
uint64_t *listener_id);
It's possible to remove a destruction listener using the destruction
listener id received when register it initially used the following
functions:
bt_trace_status bt_trace_remove_destruction_listener(
const bt_trace *trace,
uint64_t listener_id);
bt_trace_class_status bt_trace_class_remove_destruction_listener(
const bt_trace_class *trace_class,
uint64_t listener_id);
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
This page took 0.025983 seconds and 4 git commands to generate.