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

Function cond_timedwait

lib/hidapi/mac/hid.c:1219–1239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1217}
1218
1219static int cond_timedwait(hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
1220{
1221 while (!dev->input_reports) {
1222 int res = pthread_cond_timedwait(cond, mutex, abstime);
1223 if (res != 0)
1224 return res;
1225
1226 /* A res of 0 means we may have been signaled or it may
1227 be a spurious wakeup. Check to see that there's actually
1228 data in the queue before returning, and if not, go back
1229 to sleep. See the pthread_cond_timedwait() man page for
1230 details. */
1231
1232 if (dev->shutdown_thread || dev->disconnected) {
1233 return -1;
1234 }
1235 }
1236
1237 return 0;
1238
1239}
1240
1241int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
1242{

Callers 1

hid_read_timeoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected