Damjan Jovanovic : dinput: Changed select to poll.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 6 05:48:45 CST 2006
Module: wine
Branch: master
Commit: b56953f49d11436598fde1d663fd4afcfcc10997
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b56953f49d11436598fde1d663fd4afcfcc10997
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Mon Nov 6 08:28:29 2006 +0200
dinput: Changed select to poll.
---
dlls/dinput/joystick_linux.c | 12 +++++++-----
dlls/dinput/joystick_linuxinput.c | 13 +++++++------
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index 9ffab1f..c43bfa9 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -53,6 +53,9 @@ #endif
#ifdef HAVE_LINUX_JOYSTICK_H
# include <linux/joystick.h>
#endif
+#ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+#endif
#include "wine/debug.h"
#include "wine/unicode.h"
@@ -897,8 +900,7 @@ static LONG calculate_pov(JoystickImpl *
}
static void joy_polldev(JoystickImpl *This) {
- struct timeval tv;
- fd_set readfds;
+ struct pollfd plfd;
struct js_event jse;
TRACE("(%p)\n", This);
@@ -907,9 +909,9 @@ static void joy_polldev(JoystickImpl *Th
return;
}
while (1) {
- memset(&tv,0,sizeof(tv));
- FD_ZERO(&readfds);FD_SET(This->joyfd,&readfds);
- if (1>select(This->joyfd+1,&readfds,NULL,NULL,&tv))
+ plfd.fd = This->joyfd;
+ plfd.events = POLLIN;
+ if (poll(&plfd,1,0) != 1)
return;
/* we have one event, so we can read */
if (sizeof(jse)!=read(This->joyfd,&jse,sizeof(jse))) {
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 85d1fdf..d7d4139 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -48,6 +48,9 @@ # if defined(EVIOCGBIT) && defined(EV_AB
# define HAVE_CORRECT_LINUXINPUT_H
# endif
#endif
+#ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+#endif
#include "wine/debug.h"
#include "wine/unicode.h"
@@ -860,8 +863,7 @@ static void calculate_ids(LPDIDATAFORMAT
}
static void joy_polldev(JoystickImpl *This) {
- struct timeval tv;
- fd_set readfds;
+ struct pollfd plfd;
struct input_event ie;
int btn, offset;
@@ -869,11 +871,10 @@ static void joy_polldev(JoystickImpl *Th
return;
while (1) {
- memset(&tv,0,sizeof(tv));
- FD_ZERO(&readfds);
- FD_SET(This->joyfd,&readfds);
+ plfd.fd = This->joyfd;
+ plfd.events = POLLIN;
- if (1>select(This->joyfd+1,&readfds,NULL,NULL,&tv))
+ if (poll(&plfd,1,0) != 1)
return;
/* we have one event, so we can read */
More information about the wine-cvs
mailing list