exiting threaded program?

Tim Golden mail at timgolden.me.uk
Wed Mar 24 12:08:06 CET 2010


On 24/03/2010 11:04, Alex Hall wrote:
> A daemon... Good idea, and that makes more sense for what the thread
> does anyway; it is just a timer, updating a variable by contacting a
> server every hour. By the way, just what is the difference between
> user32.PostQuitMessage (0) and sys.exit()?

The former is a notification to a Windows message loop (something
most Python programs don't have) that it should exit; the latter
is a system call to exit the running program -- after any message
loops have completed if applicable.

BTW if you're running a Windows message loop anyway, you could just
use Windows timers, catch the WM_TIMER message and avoid the complication
of threads. Just an idea.

TJG



More information about the Python-list mailing list