waitfor()

Updated: May 06, 2022

Wait until a stat() on the specified path succeeds

Synopsis:

#include <libgen.h>

int waitfor( const char *path,
             int delay_ms,
             int poll_ms );

Arguments:

path
The path you want to wait for.
delay_ms
The maximum time, in milliseconds, that you want to wait for.
poll_ms
The number of millseconds to delay between checks, or 0 to disable polling.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The waitfor() function pauses until a stat() on the specified path succeeds, up to a maximum time of delay_ms milliseconds, checking every poll_ms milliseconds. If you're waiting for a mountpoint, polling isn't necessary; you can specify 0 for poll_ms in this case.

The stat() operation is relatively expensive on QNX Neutrino, so you should avoid having several processes concurrently use waitfor() with small polling periods because this can create a lot of resource contention on your system.

Returns:

0
The path exists.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes