lib: add interrupter API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 20 Jul 2019 22:20:05 +0000 (18:20 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Aug 2019 18:05:19 +0000 (14:05 -0400)
commit3357333364431ad2ce40395fdbcb1a5a9a2be312
treecc1187de825fe274e1e835c571b39c5e18053480
parent692f1a01e05d5020f4cf34eaa73973cd0b4c130d
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.026649 seconds and 4 git commands to generate.