File:  [gforth] / gforth / Attic / select.c
Revision 1.2: download - view: text, annotated - select for diffs
Thu Feb 2 18:13:13 1995 UTC (24 years, 5 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
added very preliminary support for Alpha/osf1
Moved flush-tos before stores to improve scheduling
merged io-dos.h and io.h
Created new Makefile for DOS
removed ToDo topcics that are already done

#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);

}

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