lib: add interrupter API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 20 Jul 2019 22:20:05 +0000 (18:20 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 24 Jul 2019 14:17:16 +0000 (10:17 -0400)
commitb70d57a123c4e4a208b988539a7eb8fceb2b63a7
tree39c5bcad3401b5fa8dee16f2091bd4caad96f9ab
parentca02df0ad8ae9a1a3640956d91ca31059d0b203a
lib: add interrupter API

This patch adds an interrupter API to the library.

An interrupter is a very simple shared object which you can set and
reset. On the const side, you can get whether or not the interrupter is
set.

The goal of this object is to be used as an async-signal-safe way to
interrupt a graph or a query executor. An interrupter object can
eventually be shared by many message iterators, interrupting all of them
at once when setting the interrupter. Moreover, a single message
iterator can have many interrupters, making it possible to interrupt one
or more specific message iterators from different interruption sources
(signal, graphical user interface input, thread-specific, etc.).

The user code is still responsible for checking the message iterator's
or sink component's interrupter's state at regular interval when
performing "long" operations.

You can create an interrupter object with bt_interrupter_create(). The
interrupter object is not set at creation time. You can set it with
bt_interrupter_set() and reset it with bt_interrupter_reset().

You can get whether or not the interrupter is set with
bt_interrupter_is_set().

This patch only adds the API: interrupter objects are not used anywhere
yet.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I610d48b70412d752b34b8d5760adf99a68d20704
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1733
CONTRIBUTING.adoc
include/Makefile.am
include/babeltrace2/babeltrace.h
include/babeltrace2/graph/interrupter-const.h [new file with mode: 0644]
include/babeltrace2/graph/interrupter.h [new file with mode: 0644]
include/babeltrace2/types.h
src/lib/graph/Makefile.am
src/lib/graph/interrupter.c [new file with mode: 0644]
src/lib/graph/interrupter.h [new file with mode: 0644]
src/lib/lib-logging.c
This page took 0.024751 seconds and 4 git commands to generate.