Module: wine Branch: master Commit: ae26ca6c286d6508b45c4348adc69d038a997707 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ae26ca6c286d6508b45c4348ad...
Author: Vitaliy Margolen wine-patches@kievinfo.com Date: Sat Dec 27 11:23:08 2008 -0700
dinput: Make find_joydevs re-entrant.
---
dlls/dinput/joystick_linuxinput.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 4dcd61e..8df143a 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -215,13 +215,11 @@ static struct JoyDev *joydevs = NULL;
static void find_joydevs(void) { - int i; - - if (have_joydevs!=-1) { - return; - } + int i;
- have_joydevs = 0; + if (InterlockedCompareExchange(&have_joydevs, 0, -1) != -1) + /* Someone beat us to it */ + return;
for (i=0;i<MAX_JOYDEV;i++) { char buf[MAX_PATH];