adb: make adb_thread_func_t return void, add adb_thread_exit.
Windows restricts the return value of threads to 32-bits, even on 64-bit
platforms. Since we don't actually return meaningful values from thread,
resolve this inconsistency with POSIX by making adb's thread abstraction
only take void functions.
Change-Id: I5c23b4432314f13bf16d606fd5e6b6b7b6ef98b5
(cherry picked from commit b5fea14e13bb6e41b36f374c954dc55faeef4627)
diff --git a/adb/usb_windows.cpp b/adb/usb_windows.cpp
index e79008f..8ecca37 100644
--- a/adb/usb_windows.cpp
+++ b/adb/usb_windows.cpp
@@ -97,7 +97,7 @@
/// Entry point for thread that polls (every second) for new usb interfaces.
/// This routine calls find_devices in infinite loop.
-void* device_poll_thread(void* unused);
+static void device_poll_thread(void*);
/// Initializes this module
void usb_init();
@@ -172,7 +172,7 @@
return 1;
}
-void* device_poll_thread(void* unused) {
+void device_poll_thread(void*) {
adb_thread_setname("Device Poll");
D("Created device thread");
@@ -180,8 +180,6 @@
find_devices();
adb_sleep_ms(1000);
}
-
- return NULL;
}
static LRESULT CALLBACK _power_window_proc(HWND hwnd, UINT uMsg, WPARAM wParam,
@@ -203,7 +201,7 @@
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
-static void* _power_notification_thread(void* unused) {
+static void _power_notification_thread(void*) {
// This uses a thread with its own window message pump to get power
// notifications. If adb runs from a non-interactive service account, this
// might not work (not sure). If that happens to not work, we could use
@@ -255,8 +253,6 @@
// shutting down. Not a big deal since the whole process will be going away
// soon anyway.
D("Power notification thread exiting");
-
- return NULL;
}
void usb_init() {