diff options
author | Fernando Carrijo <fcarrijo@yahoo.com.br> | 2010-08-03 16:25:24 +0300 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-08-03 18:30:03 +0300 |
commit | a2bff7454d7d427bc1b770ad73db9f9e076895f5 (patch) | |
tree | 4f8ed7f1a397e93618c68ed0caacf953910a029d | |
parent | 3a0c29feaea2f5aece073bc62ec6663e2bd57d9d (diff) |
os: inputthread: read input devices only triggered by select
s/InputDevices/ReadyInputDevices/
After WaitForInput awakens from Select, ReadyInputDevices is the only
trustable source of information about input devices which can be _read_
without blocking. Use it instead of InputThreadFd. The latter encompasses all
devices serviced by the input thread; be they ready or not.
Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
-rw-r--r-- | os/inputthread.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/os/inputthread.c b/os/inputthread.c index a8c9fd361..0a950fa12 100644 --- a/os/inputthread.c +++ b/os/inputthread.c @@ -85,16 +85,16 @@ static void* WaitForInput(void* argument) { int i; - fd_set InputDevices; + fd_set ReadyInputDevices; tid_generation = syscall(__NR_gettid); - FD_ZERO(&InputDevices); + FD_ZERO(&ReadyInputDevices); while (1) { - XFD_COPYSET (&InputThreadFd, &InputDevices); - i = Select(MaxInputDevices, &InputDevices, NULL, NULL, NULL); + XFD_COPYSET (&InputThreadFd, &ReadyInputDevices); + i = Select(MaxInputDevices, &ReadyInputDevices, NULL, NULL, NULL); DebugF("threading input generation\n"); if (i <= 0) /* An error or timeout occurred */ { @@ -115,7 +115,7 @@ WaitForInput(void* argument) else { for (i = 0; i < NumDevicesThreaded; i++) - if ((FD_ISSET(ThreadDevFunc[i].fd, &InputThreadFd)) + if ((FD_ISSET(ThreadDevFunc[i].fd, &ReadyInputDevices)) && ThreadDevFunc[i].f) (*ThreadDevFunc[i].f)(ThreadDevFunc[i].closure); |