CLAASSEN@HNYKUN53.BITNET (04/09/90)
Does anybody know of a way to make GNU sleep for milli-seconds instead of seconds. (Our OS is ULTRIX) Thanks, Wim
jr@bbn.com (John Robinson) (04/10/90)
In article <9004091446.AA02335@life.ai.mit.edu>, CLAASSEN@HNYKUN53 writes: >Does anybody know of a way to make GNU sleep for milli-seconds instead >of seconds. (Our OS is ULTRIX) There is one for the Sun, in sunfns.c: /* * Sun sleep-for (allows a shorter interval than the regular sleep-for) */ DEFUN ("sleep-for-millisecs", Fsleep_for_millisecs, Ssleep_for_millisecs, 1, 1, 0, "Pause, without updating display, for ARG milliseconds.") (n) Lisp_Object n; { unsigned useconds; CHECK_NUMBER (n, 0); useconds = XINT(n) * 1000; usleep(useconds); return(Qt); } This depends on the system call usleep(), which sleeps for a specified number of microseconds. Given the appropriate system call, you could put this functionality into emacs under Ultrix (addf it to the source). -- /jr, nee John Robinson Life did not take over the globe by combat, jr@bbn.com or bbn!jr but by networking -- Lynn Margulis
montnaro@spyder.crd.ge.com (Skip Montanaro) (04/10/90)
usleep() can be faked with select(). Something like (from off the top of my
head - don't blame me if it's broken :-):
int
usleep(useconds)
long useconds; /* microseconds */
{
struct timeval t;
t.tv_sec = 0;
t.tv_usec = useconds;
return select(0, 0, 0, 0, &t);
}
--
Skip (montanaro@crdgw1.ge.com)