diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-04 21:50:14 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-04 21:50:14 -0700 |
commit | b7cd119b0c126371eea647e13eb636dfbdfea5e2 (patch) | |
tree | 1831eaa1942151b1c33e82f50353c989bfbcc07d /sleekxmpp/xmlstream | |
parent | 6c8a135612e1bc9a8da9347cdf1ae6c3858799c3 (diff) | |
parent | 7f90de887a7e3ca53103babf5a9acf15a69ab959 (diff) | |
download | slixmpp-b7cd119b0c126371eea647e13eb636dfbdfea5e2.tar.gz slixmpp-b7cd119b0c126371eea647e13eb636dfbdfea5e2.tar.bz2 slixmpp-b7cd119b0c126371eea647e13eb636dfbdfea5e2.tar.xz slixmpp-b7cd119b0c126371eea647e13eb636dfbdfea5e2.zip |
Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 15bbe655..41c53a3e 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -831,7 +831,7 @@ class XMLStream(object): self.send_queue.put(data) return True - def process(self, threaded=True): + def process(self, **kwargs): """ Initialize the XML streams and begin processing events. @@ -839,14 +839,28 @@ class XMLStream(object): by HANDLER_THREADS. Arguments: + block -- If block=False then event dispatcher will run + in a separate thread, allowing for the stream to be + used in the background for another application. + Otherwise, process(block=True) blocks the current thread. + Defaults to False. + + **threaded is deprecated and included for API compatibility** threaded -- If threaded=True then event dispatcher will run in a separate thread, allowing for the stream to be used in the background for another application. Defaults to True. - Event handlers and the send queue will be threaded - regardless of this parameter's value. + Event handlers and the send queue will be threaded + regardless of these parameters. """ + if kwargs.has_key('threaded') and kwargs.has_key('block'): + raise ValueError("process() called with both block and threaded arguments") + elif kwargs.has_key('block'): + threaded = not(kwargs.get('block', False)) + else: + threaded = kwargs.get('threaded', True) + self.scheduler.process(threaded=True) def start_thread(name, target): |