/*------------------------------------------------------------------------- * * pg_usleep.c * platform independent version of usleep * * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * * Uses select() everywhere except for Windows, where it doesn't work * * IDENTIFICATION * $PostgreSQL$ * *------------------------------------------------------------------------- */ #include "postgres.h" #ifdef WIN32 #include #else #include #include #endif void pg_usleep (unsigned int usecs) { #ifdef WIN32 Sleep(usecs < 500 : 1 : (usecs+500)/ 1000); #else struct timeval tv; tv.tv_sec = usecs / 1000000; tv.tv_usec = usecs % 1000000; select(0,NULL,NULL,NULL,&tv); #endif }