_wyield

Description

Yields processor control from a QuickWin program for Windows queue servicing.

#include <io.h>

void _wyield( void );

Remarks

The _wyield function yields control to Windows in order to give processor time to other Windows applications. This routine is used only in QuickWin programs; it is not part of the Windows API. For full details about QuickWin, see Chapter 8 of Programming Techniques (in the Microsoft C/C++ version 7.0 documentation set).

A Windows application must service its message queue periodically to ensure smooth appearance and performance. Well-behaved QuickWin applications yield time to other applications and allow the user to switch tasks without having to wait for the QuickWin program to complete lengthy processing.

The compiler attempts to issue “yield for queue servicing” calls at appropriate times. But in some cases a program requires additional yield calls, particularly during lengthy processing loops. If Windows appears sluggish when running a QuickWin program, insert _wyield calls into the program to improve Windows' responsiveness. Note that when an application is servicing the message queue (yielding) it can be told to stop so the user can work with another running Windows application.

Return Value

None.

Compatibility

Standards:None

16-Bit:QWIN

32-Bit:None

See Also

_fwopen, _wabout, _wclose, _wgetexit, _wgetfocus, _wgetscreenbuf, _wgetsize, _wmenuclick, _wopen, _wsetexit, _wsetfocus, _wsetscreenbuf, _wsetsize

Example

/* WYIELD.C - Demonstrate yielding processor time from a

* QuickWin program so that other Windows programs can

* process their message queues; uses _wyield

*/

#include <io.h>

void compute( int a ); /* Function prototype */

void main( void )

{

int l;

for( l = 0; l <= 10000; l++ )

{

compute( l ); /* Time-consuming function you supply */

if( l % 1000 )

_wyield(); /* Yield once every 1000 loops */

}

}

void compute( int a )

{

/* Intensive computations */

}