File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1215,16 +1215,16 @@ static void* callback_thread(void* user_data)
12151215{
12161216 (void ) user_data ;
12171217
1218- /* 5 msec timeout seems reasonable; don't set too low to avoid high CPU usage */
1219- /* This timeout only affects how much time it takes to stop the thread */
1220- hidapi_timespec ts ;
1221- ts .tv_sec = 0 ;
1222- ts .tv_nsec = 5000000 ;
1223-
12241218 hidapi_thread_mutex_lock (& hid_hotplug_context .callback_thread );
12251219
12261220 /* We stop the thread if by the moment there are no events left in the queue there are no callbacks left */
12271221 while (1 ) {
1222+ /* 5 msec timeout seems reasonable; don't set too low to avoid high CPU usage */
1223+ /* This timeout only affects how much time it takes to stop the thread */
1224+ hidapi_timespec ts ;
1225+ hidapi_thread_gettime (& ts );
1226+ hidapi_thread_addtime (& ts , 5 );
1227+
12281228 /* Make the tread fall asleep and wait for a condition to wake it up */
12291229 hidapi_thread_cond_timedwait (& hid_hotplug_context .callback_thread , & ts );
12301230
You can’t perform that action at this time.
0 commit comments