bindings: python: examples: add graceful exit to async_watch_line_value
authorKent Gibson <warthog618@gmail.com>
Tue, 17 Sep 2024 12:54:55 +0000 (20:54 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 20 Sep 2024 09:21:24 +0000 (11:21 +0200)
commit5715f61fd204d232925b30c26e20cce4993ddf5a
tree56fdc577dc81e0ce019d6a31c9f7aad879dfb1b8
parentc840e17a9ca05e44ec823b77843ab0e8b88691c3
bindings: python: examples: add graceful exit to async_watch_line_value

The purpose of the example is demonstrate using a request with poll().
It provides a hint as to how the poll can be combined with other fds but,
as Python comes with batteries included, the Python version of the example
can be readily extended to actually demonstrate this, as well as how it
can be used in multi-threaded environments.

Extend the example to use an eventfd to allow the poll() to be run in
a background thread and be gracefully terminated by the main thread.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240917125455.324551-1-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/examples/async_watch_line_value.py