Curses and Threading

Brett.Friermood at gmail.com Brett.Friermood at gmail.com
Tue Jan 22 11:23:11 EST 2008


> In fact you have *two* threads: the main thread, and the one you create
> explicitly.

> After you start the clock thread, the main thread continues executing,
> immediately entering the finally clause.
> If you want to wait for the other thread to finish, use the join() method.
> But I'm unsure if this is the right way to mix threads and curses.

This is what the python documentation says:

join([timeout])
    Wait until the thread terminates. This blocks the calling thread
until the thread whose join() method is called terminates.

So according to this since I need to block the main thread until the
clock thread ends I would need the main thread to call
"cadtime().join()", correct? I'm not sure how to do this because I
don't have a class or anything for the main thread that I know of. I
tried putting that after cadtime().start() but that doesn't work. I
guess what I'm trying to say is how can I tell the main thread what to
do when it doesn't exist in my code?

Thanks for the help
-Brett



More information about the Python-list mailing list