lib: use object pool for event and packet notifications
[babeltrace.git] / lib / graph / notification / stream.c
index af6156333141a4f5a13e125c517f721217db3a56..a1ce7a5aa995f1ebf98ead1048b0efe2e4b97c18 100644 (file)
@@ -49,15 +49,13 @@ void bt_notification_stream_end_destroy(struct bt_object *obj)
 }
 
 struct bt_notification *bt_notification_stream_end_create(
-               struct bt_stream *stream)
+               struct bt_graph *graph, struct bt_stream *stream)
 {
        struct bt_notification_stream_end *notification;
        struct bt_stream_class *stream_class;
 
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
-       BT_ASSERT_PRE(stream->pos.fd < 0,
-               "Stream is a CTF writer stream: %!+s", stream);
-       stream_class = bt_stream_borrow_stream_class(stream);
+       stream_class = bt_stream_borrow_class(stream);
        BT_ASSERT(stream_class);
        BT_LOGD("Creating stream end notification object: "
                "stream-addr=%p, stream-name=\"%s\", "
@@ -75,7 +73,7 @@ struct bt_notification *bt_notification_stream_end_create(
 
        bt_notification_init(&notification->parent,
                        BT_NOTIFICATION_TYPE_STREAM_END,
-                       bt_notification_stream_end_destroy);
+                       bt_notification_stream_end_destroy, NULL);
        notification->stream = bt_get(stream);
        BT_LOGD("Created stream end notification object: "
                "stream-addr=%p, stream-name=\"%s\", "
@@ -90,7 +88,7 @@ error:
        return NULL;
 }
 
-struct bt_stream *bt_notification_stream_end_get_stream(
+struct bt_stream *bt_notification_stream_end_borrow_stream(
                struct bt_notification *notification)
 {
        struct bt_notification_stream_end *stream_end;
@@ -100,7 +98,7 @@ struct bt_stream *bt_notification_stream_end_get_stream(
                BT_NOTIFICATION_TYPE_STREAM_END);
        stream_end = container_of(notification,
                        struct bt_notification_stream_end, parent);
-       return bt_get(stream_end->stream);
+       return stream_end->stream;
 }
 
 static
@@ -117,15 +115,13 @@ void bt_notification_stream_begin_destroy(struct bt_object *obj)
 }
 
 struct bt_notification *bt_notification_stream_begin_create(
-               struct bt_stream *stream)
+               struct bt_graph *graph, struct bt_stream *stream)
 {
        struct bt_notification_stream_begin *notification;
        struct bt_stream_class *stream_class;
 
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
-       BT_ASSERT_PRE(stream->pos.fd < 0,
-               "Stream is a CTF writer stream: %!+s", stream);
-       stream_class = bt_stream_borrow_stream_class(stream);
+       stream_class = bt_stream_borrow_class(stream);
        BT_ASSERT(stream_class);
        BT_LOGD("Creating stream beginning notification object: "
                "stream-addr=%p, stream-name=\"%s\", "
@@ -143,7 +139,7 @@ struct bt_notification *bt_notification_stream_begin_create(
 
        bt_notification_init(&notification->parent,
                        BT_NOTIFICATION_TYPE_STREAM_BEGIN,
-                       bt_notification_stream_begin_destroy);
+                       bt_notification_stream_begin_destroy, NULL);
        notification->stream = bt_get(stream);
        BT_LOGD("Created stream beginning notification object: "
                "stream-addr=%p, stream-name=\"%s\", "
@@ -158,7 +154,7 @@ error:
        return NULL;
 }
 
-struct bt_stream *bt_notification_stream_begin_get_stream(
+struct bt_stream *bt_notification_stream_begin_borrow_stream(
                struct bt_notification *notification)
 {
        struct bt_notification_stream_begin *stream_begin;
@@ -168,5 +164,5 @@ struct bt_stream *bt_notification_stream_begin_get_stream(
                BT_NOTIFICATION_TYPE_STREAM_BEGIN);
        stream_begin = container_of(notification,
                        struct bt_notification_stream_begin, parent);
-       return bt_get(stream_begin->stream);
+       return stream_begin->stream;
 }
This page took 0.028915 seconds and 4 git commands to generate.