looking for usleep() implementation for ULTRIX

Alexios Zavras zvr at natasha.cs.wisc.EDU
Fri Oct 20 03:53:10 AEST 1989


In article <8896 at spool.cs.wisc.edu>, I wrote:
> #define macro(x)	do { stmt1(x); stmt2(x); ... } while (0);

and later...

> #define usleep(usec)
>         do                                                              \
>         {                                                                \
>             struct timeval  usl_delay;                                    \
>             usl_delay.tv_sec  = (int) (usec) / 1000000;                    \
>             usl_delay.tv_usec = (int) (usec) % 1000000;                     \
>             (void) select(0,(fd_set *)0,(fd_set *)0,(fd_set *)0,
&usl_delay);\
>         } while (0);

Sorry, I must have been asleep! :-)

You naturally have to omit the final `;' in both cases, i.e.:

#define macro(x)	do { stmt1(x); stmt2(x); ... } while (0)

Then you can easily write 
	if (...)
		macro(...);
	else
		...

without any problems...

Sorry about that,
-- zvr --
	+-----------------------+	Alexios Zavras
	| Life is once, forever |	zvr at cs.wisc.edu
	+-----------------H C-B-+	zavras at cs.wisc.edu
Live from:
Wisconsin: land of Orson Welles, Frank Lloyd Wright,
		   Harry Houdini  and Spencer Tracy
	       (of Joe McCarthy, too, but we try to forget that)



More information about the Comp.unix.ultrix mailing list