[Tutor] Re: how do I sleep?
alan.gauld@bt.com
alan.gauld@bt.com
Thu, 29 Nov 2001 10:55:52 -0000
> I'm not aware of anything like that (in Python or C) other than
> "sleep". If you sleep, then your process isn't doing anything and the
> kernel will (should!) give the CPU to another process that is doing
> something. That's what you're looking for, right?
Kind of. What he's looking for is a call that tells the OS to
process any other active processes but if there aren't any come
right back here. In other words only pause if you need to.
Sleep pauses regardless.
This is only necessary on coopoerative multitasking environments
like Win3x and Win 9x and early OS/2 and Mac. On Unix, NT etc this
should not be needed as the kernewl will switch processes
pre-emptively. (Win 9x will do so too provided the program is
100% Win32 clean, unfortunately few are which is why so many
programs still hang for long periods in Win9x...)
Alan g.