usleep.c

来自「spice中支持多层次元件模型仿真的可单独运行的插件源码」· C语言 代码 · 共 39 行

C
39
字号
/* $Header: /home/harrison/c/tcgmsg/ipcv4.0/RCS/usleep.c,v 1.1 91/12/06 17:26:20 harrison Exp Locker: harrison $ */#ifdef AIX#include <stdio.h>#include <sys/select.h>#endif#include <sys/types.h>#include <sys/time.h>#ifdef STUPIDUSLEEPvoid USleep(us)     long us;{  int s = us/1000000;  if (s == 0)	s = 1;  (void) sleep(s);}#elsevoid USleep(us)     long us;/*  Sleep for the specified no. of micro-seconds ... uses the timeout  on select ... it seems to be accurate to about a few centiseconds  on a sun.  I don't know how much system resources it eats.*/{  int width=0;  struct timeval timelimit;  timelimit.tv_sec = (int) (us/1000000);  timelimit.tv_usec = (int) (us - timelimit.tv_sec*1000000);  (void) select(width, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0,		&timelimit);}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?