Xref: utzoo comp.unix.questions:31192 comp.unix.wizards:25522 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!wuarchive!udel!princeton!phoenix!pfalstad From: pfalstad@phoenix.princeton.edu (Paul Falstad) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: talk session Message-ID: <69033@rtfm.Princeton.EDU> Date: 10 May 91 08:56:52 GMT References: <1489@cvbnetPrime.COM> <1991May9.161406.21802@hal.com> Sender: gnus@idunno.Princeton.EDU Organization: League For Fighting Chartered Accountancy Lines: 51 natha@hal.com (Nathaniel Ingersol) wrote: >In article <1489@cvbnetPrime.COM> mkaminsk@cvbnet.prime.com (mailhost) writes: >: >:Actually usleep(3) is going away in System V Release 4 (SVr4) >:so you can use select(2): >: >: #include >: #include >: #include >: >: struct timeval timeout; >: >: timeout.tv_sec = 0; >: timeout.tv_usec = number_of_microseconds; >: >: /* call select for it's timeout feature */ >: select(1, NULL, NULL, NULL, &timeout); >: > >Am I missing something here, or why can't you just make a usleep out >of setitimer? You could even use ITIMER_REAL. You could just do this, yes. --- #include #include #include int handler(){;} /* needed to make pause() work */ usleep(unsigned usec) { struct itimerval ix; ix.it_value.tv_sec = 0; ix.it_value.tv_usec = usec; ix.it_interval.tv_sec = 0; ix.it_interval.tv_usec = 0; signal(SIGALRM,handler); setitimer(ITIMER_REAL,&ix,NULL); pause(); signal(SIGALRM,SIG_DFL); } --- Looks harder to me. :-) -- Paul Falstad pfalstad@phoenix.princeton.edu And on the roads, too, vicious gangs of KEEP LEFT signs! If Princeton knew my opinions, they'd have expelled me long ago.