Article View: comp.windows.ms
Article #13434Re: Yield?
From: Bill Turner
Date: Mon, 09 Jan 1989 17:42
Date: Mon, 09 Jan 1989 17:42
23 lines
1080 bytes
1080 bytes
> how does one use the Yield call?
One doesn't. If your application has windows, then Yield is a no-op.
If you want to yield control, you must empty the message queue. That
means either calling GetMessage to empty the queue (and block till a
message arrives), or using PeekMessage. Thus, you can do something
like:
while (more processing required) {
do processing;
while (PeekMessage(&msg, hWnd, 0, 0, TRUE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
You do *NOT* want to throw away the messages comming in during this
loop, so you have to be careful of reentrancy problems. As far as I know,
this is the only way to yield during message processing.
--Bill Turner
Technical Details
Message-ID:
<106580013@hpcvlx.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!pasteur!ucbvax!hplabs!hp-pcd!hpcvlx!bturnerReferences:
<33575@grapevine.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!pasteur!ucbvax!hplabs!hp-pcd!hpcvlx!bturner From: bturner@hpcvlx.HP.COM (Bill Turner) Newsgroups: comp.windows.ms Subject: Re: Yield? Message-ID: <106580013@hpcvlx.HP.COM> Date: 9 Jan 89 17:42:51 GMT References: <33575@grapevine.uucp> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 23