Add frozen property to notification objects
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 3 Apr 2017 23:41:35 +0000 (19:41 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:40 +0000 (12:57 -0400)
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 <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/graph/notification-internal.h
include/babeltrace/graph/notification.h
lib/component/iterator.c

index c5a542d776274b8d64067f5a78632c94f8c15f62..01eb59670cc3fb89802df7eb180c2b0f21c5b97e 100644 (file)
@@ -27,6 +27,7 @@
  * SOFTWARE.
  */
 
+#include <stdbool.h>
 #include <babeltrace/ref-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/object-internal.h>
@@ -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
index d17973372d99db698de2885a812411840ca8822f..c768baaef813513ce419fa468f5f0eb5ac6e1dc5 100644 (file)
@@ -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. */
 };
 
index 5e70e719463df9fdf5dcfea552a8431a02511a8d..ab2783d5b7d258a42bfe7c781ba4cffa67c4afee 100644 (file)
@@ -33,6 +33,7 @@
 #include <babeltrace/graph/component-class-internal.h>
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/notification-internal.h>
 
 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:
This page took 0.027695 seconds and 4 git commands to generate.