PostgreSQL Source Code  git master
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

◆ pg_usleep()

void pg_usleep ( long  microsec)

Definition at line 47 of file pgsleep.c.

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

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