File:  [gforth] / gforth / Attic / select.c
Revision 1.1: download - view: text, annotated - select for diffs
Mon Dec 12 17:10:50 1994 UTC (29 years, 4 months ago) by anton
Branches: MAIN
CVS tags: HEAD
Reorganized configuration: configure is now created by autoconf from
configure.in; I still left it in the CVS repository because not
everyone has autoconf. decstation.h renamed to mips.h and apollo68k to
m68k. Added general 32bit.h description, which the other machine
descriptions use. Created/copied replacement files install-sh memcmp.c
memmove.c select.c (carved out from ecvt.c) strtol.c
strtoul.c. Bytesex is now handled by configure.

Deciding the threading method is now done in machine.h, this should
also be done for USE_TOS and USE_FTOS.

#include <sys/time.h>

/* select replacement for DOS computers for ms only */
void select(int n, int a, int b, int c, struct timeval * timeout)
{
   struct timeval time1;
   struct timeval time2;
   struct timezone zone1;

   gettimeofday(&time1,&zone1);
   time1.tv_sec += timeout->tv_sec;
   time1.tv_usec += timeout->tv_usec;
   if(time1.tv_usec >= 1000000)
     {
	time1.tv_sec += time1.tv_usec / 1000000;
	time1.tv_usec %= 1000000;
     }
   do
     {
	gettimeofday(&time2,&zone1);
     }
   while(time2.tv_sec < time1.tv_sec);

   do
     {
	gettimeofday(&time2,&zone1);
     }
   while(time2.tv_usec < time1.tv_usec &&
	 time2.tv_sec == time1.tv_sec);

}

/* cheap ecvt replacement */


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>