[Tutor] Re: how do I sleep?

dman dsh8290@rit.edu
Thu, 29 Nov 2001 10:27:25 -0500


On Thu, Nov 29, 2001 at 10:55:52AM +0000, alan.gauld@bt.com wrote:
| > 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 

I see now.

| 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...)

Yeah, I do remember reading that Win9x was a cooperative multitasking
system, and that is (part of) why a single user-land app can destroy
the whole system.

All of my development has either been on Unix or when it was in
Windows it was not windows-specific and yielding wasn't a concern
(either gui based or a simple batch-type script).

-D

-- 

Bugs come in through open windows. Keep Windows shut!