Changeset 79edc36 in mainline for uspace/app/top/input.c
- Timestamp:
- 2010-04-01T15:21:03Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 62550dce
- Parents:
- 83a957a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/input.c
r83a957a r79edc36 62 62 #include <ipc/console.h> 63 63 64 #define READ_TIMEOUT 100000064 #define USEC_COUNT 1000000 65 65 66 66 /* return true iff the given timeval is positive */ … … 154 154 * Eat any input that might be available. 155 155 */ 156 void tsleep( void)156 void tsleep(unsigned int sec) 157 157 { 158 158 struct timeval tv; 159 159 160 160 tv.tv_sec = 0; 161 tv.tv_usec = READ_TIMEOUT;161 tv.tv_usec = sec * USEC_COUNT; 162 162 while (TV_POS(&tv)) 163 163 if (rwait(&tv)) { … … 170 170 * getchar with timeout. 171 171 */ 172 int tgetchar( void)172 int tgetchar(unsigned int sec) 173 173 { 174 174 static struct timeval timeleft; … … 176 176 177 177 /* 178 * Reset timeleft to READ_TIMEOUT whenever it is not positive.178 * Reset timeleft to USEC_COUNT whenever it is not positive. 179 179 * In any case, wait to see if there is any input. If so, 180 180 * take it, and update timeleft so that the next call to … … 186 186 if (!TV_POS(&timeleft)) { 187 187 timeleft.tv_sec = 0; 188 timeleft.tv_usec = READ_TIMEOUT;188 timeleft.tv_usec = sec * USEC_COUNT; 189 189 } 190 190
Note:
See TracChangeset
for help on using the changeset viewer.