diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-05-17 14:56:37 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-05-17 14:56:37 +0200 |
commit | 25bc2d11234f353858da5259d8c14627c677a8bc (patch) | |
tree | f098974e1771aa62b8d330268b15fa5bf184df4c /src/bus.py | |
parent | update dist (diff) | |
download | python-bus-25bc2d11234f353858da5259d8c14627c677a8bc.tar.gz python-bus-25bc2d11234f353858da5259d8c14627c677a8bc.tar.bz2 python-bus-25bc2d11234f353858da5259d8c14627c677a8bc.tar.xz |
update poll
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/bus.py | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -184,7 +184,7 @@ class Bus: raise self.__oserror() - def poll_start(self, flags : int = 0): + def poll_start(self): ''' Announce that the thread is listening on the bus. This is required so the will does not miss any @@ -192,13 +192,9 @@ class Bus: not calling this function will cause the bus the misbehave, is `Bus.poll` is written to expect this function to have been called. - - @param flags:int `Bus.NOWAIT` if the bus should fail with `os.errno.EAGAIN` - if there isn't already a message available on the bus when - `Bus.poll` is called ''' from native_bus import bus_poll_start_wrapped - (r, e) = bus_poll_start_wrapped(self.bus, flags) + (r, e) = bus_poll_start_wrapped(self.bus) if r == -1: raise self.__oserror(e) @@ -215,7 +211,7 @@ class Bus: raise self.__oserror(e) - def poll(self) -> bytes: + def poll(self, flags : int = 0) -> bytes: ''' Wait for a message to be broadcasted on the bus. The caller should make a copy of the received message, @@ -224,11 +220,13 @@ class Bus: started, the caller of this function should then either call `Bus.poll` again or `Bus.poll_stop`. - @return :bytes The received message - NB! The received message will not be decoded from UTF-8 + @param flags:int `Bus.NOWAIT` if the bus should fail with `os.errno.EAGAIN` + if there isn't already a message available on the bus + @return :bytes The received message + NB! The received message will not be decoded from UTF-8 ''' from native_bus import bus_poll_wrapped - (message, e) = bus_poll_wrapped(self.bus) + (message, e) = bus_poll_wrapped(self.bus, flags) if message is None: raise self.__oserror(e) return message |