X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fiterator.c;fp=lib%2Fiterator.c;h=155fcbe6f7382a332ba3967e0cde86b21f5b40f7;hp=009fcd3fecf0b502e19a4719225d470fd4719c7d;hb=8793d9f8b7d71898bd3097af5e584517268370d4;hpb=a7ac9efd15a5a41c3f10358de621923099531755 diff --git a/lib/iterator.c b/lib/iterator.c index 009fcd3f..155fcbe6 100644 --- a/lib/iterator.c +++ b/lib/iterator.c @@ -65,6 +65,9 @@ static int stream_read_event(struct ctf_file_stream *sin) ret = sin->pos.parent.event_cb(&sin->pos.parent, &sin->parent); if (ret == EOF) return EOF; + else if (ret == EAGAIN) + /* Stream is inactive for now (live reading). */ + return EAGAIN; else if (ret) { fprintf(stderr, "[error] Reading event failed.\n"); return ret; @@ -803,9 +806,17 @@ int bt_iter_next(struct bt_iter *iter) assert(removed == file_stream); ret = 0; goto end; + } else if (ret == EAGAIN) { + /* + * The stream is inactive for now, we just updated the timestamp_end + * to skip over this stream up to a certain point in time. + */ + goto reinsert; } else if (ret) { goto end; } + +reinsert: /* Reinsert the file stream into the heap, and rebalance. */ removed = bt_heap_replace_max(iter->stream_heap, file_stream); assert(removed == file_stream);