summaryrefslogtreecommitdiff
path: root/src/python-systemd/docs
diff options
context:
space:
mode:
Diffstat (limited to 'src/python-systemd/docs')
-rw-r--r--src/python-systemd/docs/journal.rst2
-rw-r--r--src/python-systemd/docs/login.rst23
2 files changed, 24 insertions, 1 deletions
diff --git a/src/python-systemd/docs/journal.rst b/src/python-systemd/docs/journal.rst
index 08756b99be..e6c42061f3 100644
--- a/src/python-systemd/docs/journal.rst
+++ b/src/python-systemd/docs/journal.rst
@@ -42,7 +42,7 @@ event loop:
>>> j = journal.Reader()
>>> j.seek_tail()
>>> p = select.poll()
- >>> p.register(j, select.POLLIN)
+ >>> p.register(j, j.get_events())
>>> p.poll()
[(3, 1)]
>>> j.get_next()
diff --git a/src/python-systemd/docs/login.rst b/src/python-systemd/docs/login.rst
index 2cd9d8cbee..6b4de64c55 100644
--- a/src/python-systemd/docs/login.rst
+++ b/src/python-systemd/docs/login.rst
@@ -3,3 +3,26 @@
.. automodule:: systemd.login
:members:
+
+.. autoclass:: Monitor
+ :undoc-members:
+ :inherited-members:
+
+Example: polling for events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This example shows that session/uid/seat/machine events can be waited
+for (using e.g. `poll`). This makes it easy to integrate Monitor in an
+external event loop:
+
+ >>> import select
+ >>> from systemd import login
+ >>> m = login.Monitor("machine")
+ >>> p = select.poll()
+ >>> p.register(m, m.get_events())
+ >>> login.machine_names()
+ []
+ >>> p.poll()
+ [(3, 1)]
+ >>> login.machine_names()
+ ['fedora-19.nspawn']