speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pygtk does not play nicely with speech-dispatcher


From: Hemant Goyal
Subject: Pygtk does not play nicely with speech-dispatcher
Date: Fri, 13 Jun 2008 14:26:57 +0530

Hi,

I am working on finding a fix for the problem that James described. We plan
to use the speechd API in OLPC and developers in the OLPC community have
advised that it would be preferable to avoid the threading approach in the
longer run.

We are trying to bye-pass the thread that speechd creates and instead add a
watch on the socket using gobject.io_add_watch. So whenever an input event
is observed on the socket we read the socket instead of reading the socket
in a loop within the thread.

The code would look something like this (thanks tomeu!):

if use_gobject:
            self._communication_thread = None
            import gobject
            gobject.io_add_watch(self._socket, gobject.IO_IN,
self.__socket_read_cb)  #if input activity on the socket is observed call
self__socket_read_cb
        else:
            self._communication_thread = \
                threading.Thread(target=self._communication, kwargs={},
                                 name="SSIP client communication thread")
            self._communication_thread.start()

The problem that I am facing at the moment is that the existence of the
_communication_thread is tested elsewhere, and I am not able to bye-pass
this test.

 # TODO: This check is dumb but seems to work.  The main thread
        # hangs without it, when the Speech Dispatcher connection is lost.
        if not self._communication_thread.isAlive():
            raise SSIPCommunicationError

Could someone in the speechd community explain what is happening in this
test and why it is important?

Thanks!
Hemant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://lists.freebsoft.org/pipermail/speechd/attachments/20080613/488320ee/attachment.htm
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]