File:  [gforth] / gforth / Attic / select.c
Revision 1.2: download - view: text, annotated - select for diffs
Thu Feb 2 18:13:13 1995 UTC (29 years, 2 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

    1: #include <sys/time.h>
    2: 
    3: /* select replacement for DOS computers for ms only */
    4: void select(int n, int a, int b, int c, struct timeval * timeout)
    5: {
    6:    struct timeval time1;
    7:    struct timeval time2;
    8:    struct timezone zone1;
    9: 
   10:    gettimeofday(&time1,&zone1);
   11:    time1.tv_sec += timeout->tv_sec;
   12:    time1.tv_usec += timeout->tv_usec;
   13:    if(time1.tv_usec >= 1000000)
   14:      {
   15: 	time1.tv_sec += time1.tv_usec / 1000000;
   16: 	time1.tv_usec %= 1000000;
   17:      }
   18:    do
   19:      {
   20: 	gettimeofday(&time2,&zone1);
   21:      }
   22:    while(time2.tv_sec < time1.tv_sec);
   23: 
   24:    do
   25:      {
   26: 	gettimeofday(&time2,&zone1);
   27:      }
   28:    while(time2.tv_usec < time1.tv_usec &&
   29: 	 time2.tv_sec == time1.tv_sec);
   30: 
   31: }

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