summaryrefslogtreecommitdiffstats
path: root/adb/usb_osx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'adb/usb_osx.cpp')
-rw-r--r--adb/usb_osx.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/adb/usb_osx.cpp b/adb/usb_osx.cpp
index af6513093..0d0b3ad63 100644
--- a/adb/usb_osx.cpp
+++ b/adb/usb_osx.cpp
@@ -401,18 +401,11 @@ void* RunLoopThread(void* unused)
return NULL;
}
-static void usb_cleanup() {
- DBG("usb_cleanup\n");
- close_usb_devices();
- if (currentRunLoop)
- CFRunLoopStop(currentRunLoop);
-}
+static int initialized = 0;
void usb_init() {
- static bool initialized = false;
- if (!initialized) {
- atexit(usb_cleanup);
-
+ if (!initialized)
+ {
adb_mutex_init(&start_lock, NULL);
adb_cond_init(&start_cond, NULL);
@@ -428,10 +421,18 @@ void usb_init() {
adb_mutex_destroy(&start_lock);
adb_cond_destroy(&start_cond);
- initialized = true;
+ initialized = 1;
}
}
+void usb_cleanup()
+{
+ DBG("usb_cleanup\n");
+ close_usb_devices();
+ if (currentRunLoop)
+ CFRunLoopStop(currentRunLoop);
+}
+
int usb_write(usb_handle *handle, const void *buf, int len)
{
IOReturn result;