void* RunLoopThread(void* args) { unsigned i; InitUSB(); currentRunLoop = CFRunLoopGetCurrent(); CFRunLoopTimerContext context = {0, NULL, NULL, NULL, NULL}; CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, 0.1, 0.1, 0, 0, &onTimerFired, &context); CFRunLoopAddTimer(currentRunLoop, timer, kCFRunLoopCommonModes); // Signal the parent that we are running adb_mutex_lock(&start_lock); adb_cond_signal(&start_cond); adb_mutex_unlock(&start_lock); CFRunLoopRun(); currentRunLoop = 0; for (i = 0; i < vendorIdCount; i++) { IOObjectRelease(notificationIterators[i]); } IONotificationPortDestroy(notificationPort); usb_cleanup(); DBG("RunLoopThread done\n"); return NULL; }
void usb_kick(usb_handle *h) { D("usb_kick\n"); adb_mutex_lock(&h->lock); adb_close(h->fd); h->fd = -1; // notify usb_open_thread that we are disconnected adb_cond_signal(&h->notify); adb_mutex_unlock(&h->lock); }
void* RunLoopThread(void* unused) { InitUSB(); currentRunLoop = CFRunLoopGetCurrent(); // Signal the parent that we are running adb_mutex_lock(&start_lock); adb_cond_signal(&start_cond); adb_mutex_unlock(&start_lock); CFRunLoopRun(); currentRunLoop = 0; IOObjectRelease(notificationIterator); IONotificationPortDestroy(notificationPort); DBG("RunLoopThread done\n"); return NULL; }
void* RunLoopThread(void* args) { unsigned i; InitUSB(); currentRunLoop = CFRunLoopGetCurrent(); CFRunLoopTimerContext context = {0, NULL, NULL, NULL, NULL}; CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, 0.1, 0.1, 0, 0, &onTimerFired, &context); CFRunLoopAddTimer(currentRunLoop, timer, kCFRunLoopCommonModes); // Signal the parent that we are running adb_mutex_lock(&start_lock); adb_cond_signal(&start_cond); adb_mutex_unlock(&start_lock); set_device_loop_state(kDeviceLoopRunning); CFRunLoopRun(); set_device_loop_state(kDeviceLoopDead); currentRunLoop = 0; for (i = 0; i < vendorIdCount; i++) { IOObjectRelease(notificationIterators[i]); } IONotificationPortDestroy(notificationPort); if (notificationIterators != NULL) { D("Before notification free\n"); free(notificationIterators); notificationIterators = NULL; } D("After all\n"); initialized = 0; DBG("RunLoopThread done\n"); return NULL; }