From: Philippe Proulx Date: Mon, 3 Apr 2017 23:41:35 +0000 (-0400) Subject: Add frozen property to notification objects X-Git-Tag: v2.0.0-pre1~389 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=e7fa96c3b54878bd96a828be1cc945abfbfc1c64;p=babeltrace.git Add frozen property to notification objects A frozen notification cannot be modified (except for its reference count). Currently, no notification can be modified after its creation anyway, but we're excepting some. The notification is frozen by bt_notification_iterator_next() when the component's "next" method is successful. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/graph/notification-internal.h b/include/babeltrace/graph/notification-internal.h index c5a542d7..01eb5967 100644 --- a/include/babeltrace/graph/notification-internal.h +++ b/include/babeltrace/graph/notification-internal.h @@ -27,6 +27,7 @@ * SOFTWARE. */ +#include #include #include #include @@ -44,6 +45,7 @@ struct bt_notification { struct bt_object base; enum bt_notification_type type; get_stream_func get_stream; + bool frozen; }; BT_HIDDEN @@ -51,6 +53,12 @@ void bt_notification_init(struct bt_notification *notification, enum bt_notification_type type, bt_object_release_func release); +BT_HIDDEN +static inline void bt_notification_freeze(struct bt_notification *notification) +{ + notification->frozen = true; +} + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/graph/notification.h b/include/babeltrace/graph/notification.h index d1797337..c768baae 100644 --- a/include/babeltrace/graph/notification.h +++ b/include/babeltrace/graph/notification.h @@ -69,6 +69,8 @@ enum bt_notification_type { /** End of trace notification, see eot.h */ BT_NOTIFICATION_TYPE_END_OF_TRACE = 8, + BT_NOTIFICATION_TYPE_INACTIVITY = 9, + BT_NOTIFICATION_TYPE_NR, /* Not part of ABI. */ }; diff --git a/lib/component/iterator.c b/lib/component/iterator.c index 5e70e719..ab2783d5 100644 --- a/lib/component/iterator.c +++ b/lib/component/iterator.c @@ -33,6 +33,7 @@ #include #include #include +#include static void bt_notification_iterator_destroy(struct bt_object *obj) @@ -226,6 +227,7 @@ bt_notification_iterator_next(struct bt_notification_iterator *iterator) BT_MOVE(iterator->current_notification, next_return.notification); + bt_notification_freeze(iterator->current_notification); } end: