Using Intel® Visual Fortran to Create and Build Windows*-Based Applications

ID 757211
Date 7/23/2021
Public
Document Table of Contents

Simulating Nonblocking I/O

QuickWin does not accept unsolicited input. You get beeps if you type into an active window if no READ or GETCHARQQ has been done. Because of this, it is necessary to do a READGETCHARQQ or in order for a character to be accepted. But this type of blocking I/O puts the program to sleep until a character has been typed.

In Fortran Console applications, PEEKCHARQQ can be used to see if a character has already been typed. However, PEEKCHARQQ does not work under Fortran QuickWin applications, since QuickWin has no console buffer to accept unsolicited input. Because of this limitation, PEEKCHARQQc annot be used as it is with Fortran Console applications to see whether a character has already been typed.

One way to simulate PEEKCHARQQ with QuickWin applications is to add an additional thread:

  • One thread does a READGETCHARQQ or and is blocked until a character typed.

  • The other thread (the main program) is in a loop doing useful work and checking in the loop to see if the other thread has received input.