[pygtk] Threads sync
frederic.mantegazza at gbiloba.org
Sat Nov 22 19:28:22 WST 2008
I have some troubles with threads in my Papywizard app.
During the shooting process, I launch a thread which iterates over all
shooting positions, and control the hardware to move the panoramic head,
and trigger the camera.
Right after this thread is launch, I periodically execute a function from
the GTK lop, using gobject.timeout_add(). In this function, I read some
variables of the external thread to refresh the GUI. The user can also
interact with the GUI during the shooting process, to pause/stop it.
All works fine on my PC (running linux), but I experience several problems
on maemo. For example, some part of the GUI are not correctly refreshed
the first time I launch the shooting process. If I stop it, and retry, all
works fine. Another issue is that I can send user action at wrong moments.
I think this a related to the lower speed execution of the application,
showing me some wrong-codeed things in my app.
So I need to add some robust inter-threads sync mecanisms, to ensure I
can't trigger actions at the wrong place. I tried to use the Event object
from the standard threading module, but it does not work under maemo
(while it works fine on the PC) :o(
So, what other mecanism should I use to sync my threads? Is there a
More information about the pygtk