PostgreSQL Source Code  git master
pgsleep.c File Reference
#include "c.h"
#include <unistd.h>
#include <sys/select.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

◆ pg_usleep()

void pg_usleep ( long  microsec)

Definition at line 45 of file pgsleep.c.

46 {
47  if (microsec > 0)
48  {
49 #ifndef WIN32
50  struct timeval delay;
51 
52  delay.tv_sec = microsec / 1000000L;
53  delay.tv_usec = microsec % 1000000L;
54  (void) select(0, NULL, NULL, NULL, &delay);
55 #else
56  SleepEx((microsec < 500 ? 1 : (microsec + 500) / 1000), FALSE);
57 #endif
58  }
59 }
#define select(n, r, w, e, timeout)
Definition: win32_port.h:492

References select.