Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1531 → Rev 1532

/uspace/trunk/libc/include/sys/time.h
33,8 → 33,8
 
#define DST_NONE 0
 
typedef sysarg_t time_t;
typedef sysarg_t suseconds_t;
typedef long time_t;
typedef long suseconds_t;
 
struct timeval {
time_t tv_sec; /* seconds */
/uspace/trunk/libc/generic/async.c
286,6 → 286,9
assert(PS_connection);
 
if (usecs < 0) /* TODO: let it get through the ipc_call once */
return 0;
 
futex_down(&async_futex);
 
if (usecs) {
655,6 → 658,10
amsg_t *msg = (amsg_t *) amsgid;
connection_t *conn;
 
/* TODO: Let it go through the event read at least once */
if (timeout < 0)
return ETIMEOUT;
 
futex_down(&async_futex);
if (msg->done) {
futex_up(&async_futex);
/uspace/trunk/tetris/input.c
41,6 → 41,7
 
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
 
#include <errno.h>
#include <unistd.h>
90,8 → 91,6
static ipc_call_t charcall;
int rc;
 
#define NILTZ ((struct timezone *)0)
 
/*
* Someday, select() will do this for us.
* Just in case that day is now, and no one has
98,7 → 97,7
* changed this, we use a temporary.
*/
if (tvp) {
(void) gettimeofday(&starttv, NILTZ);
(void) gettimeofday(&starttv, NULL);
endtv = *tvp;
s = &endtv;
} else
107,7 → 106,9
if (!lastchar) {
if (!getchar_inprog)
getchar_inprog = async_send_2(1,CONSOLE_GETCHAR,0,0,&charcall);
if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) {
if (!s)
async_wait_for(getchar_inprog, &rc);
else if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) {
tvp->tv_sec = 0;
tvp->tv_usec = 0;
return (0);
120,7 → 121,7
}
if (tvp) {
/* since there is input, we may not have timed out */
(void) gettimeofday(&endtv, NILTZ);
(void) gettimeofday(&endtv, NULL);
TV_SUB(&endtv, &starttv);
TV_SUB(tvp, &endtv); /* adjust *tvp by elapsed time */
}
/uspace/trunk/tetris/screen.c
159,7 → 159,7
if (Rows < MINROWS || Cols < MINCOLS) {
char smallscr[55];
 
(void)snprintf(smallscr, sizeof(smallscr),
snprintf(smallscr, sizeof(smallscr),
"the screen is too small (must be at least %dx%d)",
MINROWS, MINCOLS);
stop(smallscr);
203,7 → 203,7
 
if (score != curscore) {
moveto(0, 0);
(void) printf("Score: %d", score);
printf("Score: %d", score);
curscore = score;
}
 
251,6 → 251,10
continue;
*sp = so;
if (i != ccol) {
if (cur_so) {
resume_normal();
cur_so = 0;
}
moveto(RTOD(j), CTOD(i));
}
if (so != cur_so) {
261,6 → 265,7
cur_so = so;
}
putstr(" ");
 
ccol = i + 1;
/*
* Look ahead a bit, to avoid extra motion if
281,8 → 286,8
}
}
}
resume_normal();
 
if (cur_so)
resume_normal();
fflush();
}