#include <stdint.h>
#include <stddef.h>
+#include <stdbool.h>
+#include <assert.h>
#include <babeltrace/ctf-ir/clock-class.h>
#include <babeltrace/object-internal.h>
#include <glib.h>
/* Clock class (weak) with the currently highest priority */
struct bt_ctf_clock_class *highest_prio_cc;
+
+ bool frozen;
};
+static inline
+void bt_clock_class_priority_map_freeze(
+ struct bt_clock_class_priority_map *cc_prio_map)
+{
+ assert(cc_prio_map);
+ cc_prio_map->frozen = true;
+}
+
#endif /* BABELTRACE_GRAPH_CLOCK_CLASS_PRIORITY_MAP_INTERNAL_H */
\em higher priority. Multiple clock classes can have the same priority
within a given clock class priority map.
+The following functions can \em freeze clock class priority map objects:
+
+- bt_notification_event_create() freezes its clock class priority
+ map parameter.
+- bt_notification_inactivity_create() freezes its clock class priority
+ map parameter.
+
+You cannot modify a frozen clock class priority map object: it is
+considered immutable, except for \link refs reference counting\endlink.
+
As with any Babeltrace object, clock class priority map objects have
<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
counts</a>. See \ref refs to learn more about the reference counting
@prenotnull{clock_class_priority_map}
@prenotnull{clock_class}
+@prehot{clock_class_priority_map}
@postrefcountsame{clock_class_priority_map}
@postsuccessrefcountinc{clock_class}
// FIXME when available: check
// bt_ctf_clock_class_is_valid(clock_class)
- if (!cc_prio_map) {
+ if (!cc_prio_map || !clock_class || cc_prio_map->frozen) {
ret = -1;
goto end;
}
#include <babeltrace/ctf-ir/stream-class-internal.h>
#include <babeltrace/ctf-ir/trace.h>
#include <babeltrace/graph/clock-class-priority-map.h>
+#include <babeltrace/graph/clock-class-priority-map-internal.h>
#include <babeltrace/graph/notification-event-internal.h>
static
}
bt_ctf_event_freeze(notification->event);
+ bt_clock_class_priority_map_freeze(notification->cc_prio_map);
return ¬ification->parent;
error:
bt_put(notification);
#include <babeltrace/compiler-internal.h>
#include <babeltrace/ctf-ir/clock-class.h>
#include <babeltrace/graph/clock-class-priority-map.h>
+#include <babeltrace/graph/clock-class-priority-map-internal.h>
#include <babeltrace/graph/notification-internal.h>
#include <babeltrace/graph/notification-inactivity-internal.h>
}
notification->cc_prio_map = bt_get(cc_prio_map);
+ bt_clock_class_priority_map_freeze(cc_prio_map);
goto end;
error: