Skip to content

Commit fa70328

Browse files
authored
Update callback timeout
1 parent e288ba1 commit fa70328

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libusb/hid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,11 +1219,11 @@ static void* callback_thread(void* user_data)
12191219

12201220
/* We stop the thread if by the moment there are no events left in the queue there are no callbacks left */
12211221
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 */
1222+
/* Pretty much any value between 2 and 100 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 if for any reason thread shutdown wasn't triggered by condition varaiable */
12241224
hidapi_timespec ts;
12251225
hidapi_thread_gettime(&ts);
1226-
hidapi_thread_addtime(&ts, 5);
1226+
hidapi_thread_addtime(&ts, 100);
12271227

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);

0 commit comments

Comments
 (0)