diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-25 12:48:52 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-25 12:48:52 +0200 |
commit | 01eb9ad09055c7add1ef29726f985325bb3f489b (patch) | |
tree | 3fbc5b9940054f4f0ec43aacbfc96f58288a07d2 /ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | |
parent | 9305fd709aca679a96784f304cc5103178301125 (diff) |
js: don't spin forever in bg thread on detach
Diffstat (limited to 'ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp')
-rw-r--r-- | ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index a132f472..66138e90 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -183,14 +183,14 @@ bool FTNoIR_Tracker::GiveHeadPoseData(double *data) if( !g_pDI || !g_pJoystick) return false; -start: auto hr = g_pJoystick->Poll(); if( FAILED( hr )) { hr = g_pJoystick->Acquire(); - while( hr == DIERR_INPUTLOST ) + for (int i = 0; hr == DIERR_INPUTLOST && i < 200; i++) hr = g_pJoystick->Acquire(); - goto start; + if (hr != DI_OK) + return false; } if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof( js ), &js ) ) ) |