Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

pgsleep.c File Reference

#include "c.h"
#include <unistd.h>
#include <sys/time.h>
Include dependency graph for pgsleep.c:

Go to the source code of this file.

Functions

void pg_usleep (long microsec)

Function Documentation

void pg_usleep ( long  microsec  ) 

Definition at line 34 of file pgsleep.c.

References FALSE, NULL, pgwin32_dispatch_queued_signals(), pgwin32_signal_event, and select.

{
    if (microsec > 0)
    {
#ifndef WIN32
        struct timeval delay;

        delay.tv_sec = microsec / 1000000L;
        delay.tv_usec = microsec % 1000000L;
        (void) select(0, NULL, NULL, NULL, &delay);
#else
        SleepEx((microsec < 500 ? 1 : (microsec + 500) / 1000), FALSE);
#endif
    }
}