On Nov 8, 2:50 pm, exar...@twistedmatrix.com wrote: > I'm curious how this visualization works, since earlier you said > something to the affect that there were no shared resources. If you > kill a thread and it had opened a window and was drawing on it, with > most toolkits, you'll end up with a window stuck in your screen, won't > you?
The Python code passes an array to the C library which in the end contains the computation results. This array only contains some kind of counts which are incremented during the computation. The PyGTK GUI simply visualizes the current state of this array in regular intervals. The C library does not do any GUI stuff. Cancelling the thread really would not do any harm -- the thread only allocates memory on the stack, and the stack will vanish with the thread. > The CPython philosophy sort of follows the guideline that you should be > allowed to do bad stuff if you want, except when that bad stuff would > crash the interpreter (clearly ctypes is an exception to this rule of > thumb). Well, I am really glad about that exception. And following the hint of Carl, I will use it to call pthread_cancel or pthread_kill directly from the library. (Most certainly I also have to use ctypes to create my threads to be able to do this.) Cheers, Sven -- http://mail.python.org/mailman/listinfo/python-list