本文整理汇总了C++中USBDevice::flush方法的典型用法代码示例。如果您正苦于以下问题:C++ USBDevice::flush方法的具体用法?C++ USBDevice::flush怎么用?C++ USBDevice::flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USBDevice
的用法示例。
在下文中一共展示了USBDevice::flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainLoop
void FCServer::mainLoop()
{
for (;;) {
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
int err = libusb_handle_events_timeout_completed(mUSB, &timeout, 0);
if (err) {
std::clog << "Error handling USB events: " << libusb_strerror(libusb_error(err)) << "\n";
// Sometimes this happens on Windows during normal operation if we're queueing a lot of output URBs. Meh.
}
// We may have been asked for a one-shot poll, to retry connecting devices that failed.
if (mPollForDevicesOnce) {
mPollForDevicesOnce = false;
usbHotplugPoll();
}
// Flush completed transfers
mEventMutex.lock();
for (std::vector<USBDevice*>::iterator i = mUSBDevices.begin(), e = mUSBDevices.end(); i != e; ++i) {
USBDevice *dev = *i;
dev->flush();
}
mEventMutex.unlock();
}
}