Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!cci632!srw From: srw@cci632.cci.com (Steve Windsor) Newsgroups: comp.windows.ms.programmer Subject: Re: What does Yield do? Message-ID: <1991May16.180405.12306@cci632.cci.com> Date: 16 May 91 18:04:05 GMT References: <1991May16.121553.3876@maytag.waterloo.edu> Reply-To: srw@op632.UUCP (Steve Windsor) Organization: CCI, Communications Systems Division, Rochester, NY Lines: 25 In article <1991May16.121553.3876@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes: > >Is there some way to configure what sort of behaviour Yield has? It's not >even mentioned in Petzold, and the TPW documentation is minimal. I don't >have the SDK manual. > >Duncan Murdoch Windows 3.0 is a non-preemptive multitasker. As such, when a process has control, no one else can gain access to the processor. This is why windows is messaged-based, to process a message and then get out, allowing the scheduler to service another process. Yield() is supposed to relenquish the processor inside a process. However, it does not work. This comes straight from Paul Yao in an Advanced Windows class, Microsoft University. In testing, Yield() does not appear to do a damn thing... Instead, look at PeekMessage(). If there is a message waiting in the process queue, you can service that message. If there is no message waiting to be serviced, you can relenquish control...the code is an if (PeekMessage(...))...else construct. I even think it's mentioned in Petzold. I can email you the sample if you wish. stephen windsor srw@op632.cci.com