PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 47 of file pgsleep.c.

References EINTR, FALSE, NULL, 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 select(n, r, w, e, timeout)
Definition: win32.h:384
#define FALSE
Definition: c.h:221
#define NULL
Definition: c.h:229