Question about the method sleepqq

Hello,

I’m having an issue using the method sleepqq with PGI compiler.
As far as I know, this method is meant to pause the execution of the program for a duration in ms.

Based on my tests, a call to sleepqq(1000) pauses the execution for 1s, but sleepqq(999) is ignored (seems identical to sleepqq(0)).

I’d like to pause my application for 500ms (in an I/O loop to check for file updates).

I’m currently using PGI 16.4.

Is there an updated implementation of this function in newer versions of PGI? Or an alternate function to pause an application for less than a second?

Thanks in advance,
Armand

Hi Armand,

Are you running on Linux or Windows?

On Linux, “sleepqq” is just a wrapper for the UNIX “sleep” function which only takes values in seconds, or 1000ms. So values smaller than 1000, would be the same as 0. You should consider using calls to “usleep” instead.

On Windows, “sleepqq” calls “Sleep” with the same argument.

-Mat

Hi Mat,

Thanks for the update. I’m working on linux, and I suspected that sleepqq implementation was using a function that only sleeps for seconds.

I’ll look at the usleep method.

Thanks again,
Armand

Hi again,

I managed to use the usleep function using iso_c_binding, and it works as expected.

Thanks again for the advice.

Armand.