Hans Meine wrote: > On Montag 20 Oktober 2008, Dirk Meyer wrote: >> Hans Meine wrote: >> > One thing that does not yet work is stopping the program; I need to kill >> > python with -9. :-(( Hope that you can fix that. >> >> I had the same problem with twisted. I have no idea what happens when >> you C-c a QT app (my non-kaa qt test app wouldn't die either). > > I think that is because the other thread is still active. It reminds me of a > problem I had in the past, which I fixed by exec()uting another program not > in the thread used to deal with its I/O, but from the main thread (and then > still reading its stdout from within the thread). Does that ring a bell? > How can I check whether the kaa thread properly stops? (I know that > kaa.main.stop() is called.)
Twisted has an event triggered at shutdown. The Twisted based threaded notifier connects to that signal and shuts the kaa loop down: | reactor.addSystemEventTrigger('after', 'shutdown', self.stop) So just call the stop function and it should work. >> But to prove my point look at your code and my requirements: I want a >> function to call from a thread to execute a callback in the >> mainloop. That isn't too hard and IMHO can happen very often. In >> twisted it took me five minutes to find callFromThread. Look again at >> your example code [...] > > Yes, I realized already that I needed a much more complicated solution than > with twisted. But IMO that's just because of different APIs, and "execute a > callback in the [main thread's] mainloop" is not a very typical requirement > (maybe more so in a python environment, but not in C++). IMHO it has nothing to do with the language. If you have a main loop based app you may be forced to use a thread somehow. If the lib is thread safe this doesn't matter, if it is not, such a function must be provided. E.g. gobject is thread-safe. It has no such function but I can register a timer from a thread and just add my callback as timer to be called in 0 seconds. That timer will be called from the mainloop. Dischi -- If windows is the answer, it must have been a stupid question. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel