summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-10-25 12:48:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-10-25 12:48:52 +0200
commit01eb9ad09055c7add1ef29726f985325bb3f489b (patch)
tree3fbc5b9940054f4f0ec43aacbfc96f58288a07d2 /ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
parent9305fd709aca679a96784f304cc5103178301125 (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.cpp6
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 ) ) )