mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
Windows: fix keystroke delay in waitkey
Fix the keystroke delay in the pthreaded wait for key function. Change-Id: I79293ceca57a418d23b0a211f875c17b805f9391 Reviewed-on: http://gerrit.openafs.org/3268 Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: Jeffrey Altman <jaltman@openafs.org> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
aac929badb
commit
27f00bb296
@ -58,12 +58,14 @@ LWP_WaitForKeystroke(int seconds)
|
|||||||
{
|
{
|
||||||
time_t startTime, nowTime;
|
time_t startTime, nowTime;
|
||||||
double timeleft = 1;
|
double timeleft = 1;
|
||||||
|
#ifndef AFS_PTHREAD_ENV
|
||||||
struct timeval twait;
|
struct timeval twait;
|
||||||
|
|
||||||
time(&startTime);
|
|
||||||
|
|
||||||
twait.tv_sec = 0;
|
twait.tv_sec = 0;
|
||||||
twait.tv_usec = LWP_KEYSTROKE_DELAY;
|
twait.tv_usec = LWP_KEYSTROKE_DELAY;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
time(&startTime);
|
||||||
|
|
||||||
if (seconds >= 0)
|
if (seconds >= 0)
|
||||||
timeleft = seconds;
|
timeleft = seconds;
|
||||||
@ -79,11 +81,10 @@ LWP_WaitForKeystroke(int seconds)
|
|||||||
/* sleep for LWP_KEYSTROKE_DELAY ms and let other
|
/* sleep for LWP_KEYSTROKE_DELAY ms and let other
|
||||||
* process run some*/
|
* process run some*/
|
||||||
#ifdef AFS_PTHREAD_ENV
|
#ifdef AFS_PTHREAD_ENV
|
||||||
select(0, 0, 0, 0, &twait);
|
Sleep(LWP_KEYSTROKE_DELAY);
|
||||||
#else
|
#else
|
||||||
IOMGR_Select(0, 0, 0, 0, &twait);
|
IOMGR_Select(0, 0, 0, 0, &twait);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (seconds > 0) { /* we only worry about elapsed time if
|
if (seconds > 0) { /* we only worry about elapsed time if
|
||||||
* not looping forever (seconds < 0) */
|
* not looping forever (seconds < 0) */
|
||||||
/* now check elapsed time */
|
/* now check elapsed time */
|
||||||
|
Loading…
Reference in New Issue
Block a user