aboutsummaryrefslogtreecommitdiffstats
path: root/src/native_bus.pyx
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/native_bus.pyx
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 'src/native_bus.pyx')
-rw-r--r--src/native_bus.pyx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/native_bus.pyx b/src/native_bus.pyx
index de33e91..fdcf341 100644
--- a/src/native_bus.pyx
+++ b/src/native_bus.pyx
@@ -68,13 +68,15 @@ Close a bus
@return 0 on success, -1 on error
'''
-cdef extern int bus_write(long, const char *)
+cdef extern int bus_write(long, const char *, int)
'''
Broadcast a message a bus
@param bus Bus information
@param message The message to write, may not be longer than
`BUS_MEMORY_SIZE` including the NUL-termination
+@param flags `BUS_NOWAIT` fail if other process is attempting
+ to write
@return 0 on success, -1 on error
'''
@@ -184,20 +186,22 @@ def bus_close_wrapped(bus : int) -> int:
return bus_close(<long>bus)
-def bus_write_wrapped(bus : int, message : str) -> int:
+def bus_write_wrapped(bus : int, message : str, flags : int) -> int:
'''
Broadcast a message a bus
@param bus Bus information
@param message The message to write, may not be longer than
`BUS_MEMORY_SIZE` including the NUL-termination
+ @param flags `BUS_NOWAIT` fail if other process is attempting
+ to write
@return 0 on success, -1 on error
'''
cdef const char* cmessage
cdef bytes bs
bs = message.encode('utf-8') + bytes([0])
cmessage = bs
- return bus_write(<long>bus, cmessage)
+ return bus_write(<long>bus, cmessage, <int>flags)
cdef int bus_callback_wrapper(const char *message, user_data):