MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / cond_wait

Function cond_wait

lib/hidapi/mac/hid.c:1198–1217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1196}
1197
1198static int cond_wait(hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex)
1199{
1200 while (!dev->input_reports) {
1201 int res = pthread_cond_wait(cond, mutex);
1202 if (res != 0)
1203 return res;
1204
1205 /* A res of 0 means we may have been signaled or it may
1206 be a spurious wakeup. Check to see that there's actually
1207 data in the queue before returning, and if not, go back
1208 to sleep. See the pthread_cond_timedwait() man page for
1209 details. */
1210
1211 if (dev->shutdown_thread || dev->disconnected) {
1212 return -1;
1213 }
1214 }
1215
1216 return 0;
1217}
1218
1219static int cond_timedwait(hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
1220{

Callers 1

hid_read_timeoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected