Making speech-dispatcher python API support asynchronous socket communication
tomeu at tomeuvizoso.net
Fri Jun 20 06:16:37 EDT 2008
On Fri, Jun 20, 2008 at 12:08 PM, Hemant Goyal <goyal.hemant at gmail.com> wrote:
> When the handshaking is taking place the gtk mainloop has not yet started
> and hence we cannot rely on the event generated by gobject to read data off
> the socket. And if this handshaking does not take place the API
> implementation blocks the entire process thus leading to a deadlock. Now I
> figured that we can allow the polling thread to exist until the handshaking
> takes place and then shift to the gobject method of monitoring the socket. I
> achieve this by defining a variable self._first_run. When the handshaking
> completes I make the polling thread exit (by calling close_thread(self) from
> the main control thread) . In this time frame I expect that the gtk mainloop
> will start itself (I am quite sure that it does start actually).
What about initializing the connection (and thus do the handshaking)
in an idle event?
I guess that the speechd maintainers don't wish to add a gobject
dependency to their packages, right? If the python API exposed the
socket and a couple of functions, the caller could be responsible for
providing integration with whatever main loop it wishes to use
(gobject or qt, for example).
More information about the Devel