blob: 6b4de64c55340f291d1376d39f2adafa46f30e8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
`systemd.login` module
=======================
.. 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']
|