Q297826: FIX: CHRSAW() Function Can Hang When AutoYield = .F.
Article: Q297826
Product(s): Microsoft FoxPro
Version(s): 5.0,5.0a,6.0
Operating System(s):
Keyword(s): kbvfp500 kbvfp500a kbvfp500aBUG kbvfp500bug kbvfp600 kbvfp600bug kbGrpDSFox kbDSupport
Last Modified: 29-AUG-2001
-------------------------------------------------------------------------------
The information in this article applies to:
- Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a, 6.0
-------------------------------------------------------------------------------
SYMPTOMS
========
If the Visual FoxPro AutoYield property is set to .F., the CHRSAW() function may
not be able to check the keyboard buffer properly, and may cause the system to
stop responding (hang).
CAUSE
=====
The AutoYield property prevents Windows event messages from interrupting program
flow. Therefore, when CHRSAW() checks to see whether any keyboard events have
come in, it can get into a state in which it continues to look for an event, but
can't find one.
STATUS
======
This problem was corrected in Microsoft Visual FoxPro version 7.0 for Windows.
MORE INFORMATION
================
Steps to Reproduce Behavior
---------------------------
The following code will eventually reproduce the behavior, although perhaps not
on the first run. If you open the Task Manager, you will see that Visual FoxPro
is taking all available CPU time.
*!* Q297826 FIX: CHRSAW() Function Can Hang System When AutoYield = .F.
CLEAR
_VFP.AutoYield = .F.
lnCount = 1000
lnStart = SECONDS()
FOR lnI = 1 TO lnCount
@ 1,1 SAY lnI
llTest = CHRSAW()
ENDFOR
? SECONDS() - lnStart
Additional query words:
======================================================================
Keywords : kbvfp500 kbvfp500a kbvfp500aBUG kbvfp500bug kbvfp600 kbvfp600bug kbGrpDSFox kbDSupport kbCodeSnippet kbvfp700fix kbvfp700
Technology : kbVFPsearch kbAudDeveloper kbVFP500 kbVFP600 kbVFP500a
Version : :5.0,5.0a,6.0
Issue type : kbbug
Solution Type : kbfix
=============================================================================
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.