Async Sleep?
Daniel Nogradi
nogradi at gmail.com
Sun Apr 16 04:40:19 EDT 2006
> Hi all,
>
> Does a async sleep exist?
> How to check this every 10 sec, but that the CPU is free?
I would use a separate thread for this, perhaps even a completely
detached daemon. You might want to check the docs for threading:
http://docs.python.org/lib/module-threading.html
and these recipes on how to create a daemon:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52216
You can also spawn a separate process with the spawn* family of
functions. If you use them with the os.P_NOWAIT mode, your program
will not hang until the spawned process finishes. See:
http://docs.python.org/lib/os-process.html
More information about the Python-list
mailing list