aboutsummaryrefslogtreecommitdiffstats
path: root/src/bus.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-05-16 17:22:22 +0200
committerMattias Andrée <maandree@operamail.com>2015-05-16 17:22:22 +0200
commit0bc4a3fa66423268ce17b57af8a5b1775dbb8a9a (patch)
tree75bd8329f91d1d2a69a52a37b2ad66ddae504403 /src/bus.py
parentupdate dist (diff)
downloadpython-bus-0bc4a3fa66423268ce17b57af8a5b1775dbb8a9a.tar.gz
python-bus-0bc4a3fa66423268ce17b57af8a5b1775dbb8a9a.tar.bz2
python-bus-0bc4a3fa66423268ce17b57af8a5b1775dbb8a9a.tar.xz
update bus.write
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/bus.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bus.py b/src/bus.py
index 4b3f9fd..7146e83 100644
--- a/src/bus.py
+++ b/src/bus.py
@@ -55,6 +55,12 @@ class Bus:
Fail if interrupted
'''
+ NOWAIT = 1
+ '''
+ Function shall fail with errno set to `EAGAIN`
+ if the it would block and this flag is used
+ '''
+
def __init__(self, pathname : str = None):
'''
@@ -131,14 +137,16 @@ class Bus:
self.bus = None
- def write(self, message : str):
+ def write(self, message : str, flags : int = 0):
'''
Broadcast a message a bus
@param message:str The message to write, may not be longer than 2047 bytes after UTF-8 encoding
+ @param flags:int `Bus.NOWAIT` if the function shall fail if there is another process attempting
+ to broadcast on the bus
'''
from native_bus import bus_write_wrapped
- if bus_write_wrapped(self.bus, message) == -1:
+ if bus_write_wrapped(self.bus, message, flags) == -1:
raise self.__oserror()