Lines Matching defs:deadline
91 static inline void tio_tv_prepare(struct timeval *deadline, const struct timeval *timeout)
93 if (gettimeofday(deadline,NULL))
96 deadline->tv_sec=0;
97 deadline->tv_usec=0;
100 tio_tv_add(deadline,timeout);
103 /* update the timeval to the value that is remaining before deadline
104 returns non-zero if there is no more time before the deadline */
105 static inline int tio_tv_remaining(struct timeval *tv, const struct timeval *deadline)
116 if ( (tv->tv_sec>deadline->tv_sec) ||
117 ( (tv->tv_sec==deadline->tv_sec) && (tv->tv_usec>deadline->tv_usec) ) )
120 tv->tv_sec=deadline->tv_sec-tv->tv_sec;
121 if (tv->tv_usec<deadline->tv_usec)
122 tv->tv_usec=deadline->tv_usec-tv->tv_usec;
126 tv->tv_usec=1000000+deadline->tv_usec-tv->tv_usec;
178 the specified deadline */
179 static int tio_select(TFILE *fp, int readfd, const struct timeval *deadline)
190 if (tio_tv_remaining(&tv,deadline))
229 struct timeval deadline;
236 /* TODO: probably only set up deadline if we have to do select() */
237 tio_tv_prepare(&deadline,&(fp->readtimeout));
295 if (tio_select(fp,1,&deadline))
371 struct timeval deadline;
373 tio_tv_prepare(&deadline,&(fp->writetimeout));
378 if (tio_select(fp,0,&deadline))