threads problem in python
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue May 13 06:38:40 EDT 2008
En Tue, 13 May 2008 06:42:13 -0300, Astan Chee <stanc at al.com.au> escribió:
> I have 2 classes in python, the first one runs first and and then the
> first one calls the second class. I want it to run the second class as a
> separate thread but I want the first one to wait until the second class
> is dead.
> Im having problem in both killing the second class when its done and
> making the first class wait for it to finish.
> Im very confused on doing threads in python.
I'm confused trying to understand your requirements too. "run a class?"
Threads execute code, it's easier to think of them as *functions* that are
executed at the same time (or almost).
So you have a function A that runs first, and creates a second thread that
will execute function B. Then A will wait for B to finish. What do you
want to do in A while it's waiting? Nothing? Then why to use a second
thread? Or is it a graphical interfase? GUI libraries like wxPython, Qt
and others have specific ways to execute backgroung tasks while keeping
the user interface responsive - you should tell us which one you're using
in that case.
--
Gabriel Genellina
More information about the Python-list
mailing list