summaryrefslogtreecommitdiff
path: root/client/usb_windows.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-04-12 17:00:49 -0700
committerJosh Gao <jmgao@google.com>2017-04-12 17:12:32 -0700
commit45f2f545d2af1378f3084fb01bd7ad9f5d8a003d (patch)
treed3891a2f06eb38850cfb66dbd6dd7b3c7c2f8ca4 /client/usb_windows.cpp
parent50cc73ab0e3d308ff6559430cb5e0e7aff626346 (diff)
downloadadb-45f2f545d2af1378f3084fb01bd7ad9f5d8a003d.tar.gz
adb: kill adb_thread_{create, join, detach, exit}.
We have std::thread now, so we can delete this cruft. Test: python test_device.py Test: adb_test Test: wine adb_test.exe Test: /data/nativetest/adbd_test/adbd_test Change-Id: Ie1c1792547b20dec45e2a62ce6515fcb981c3ef8
Diffstat (limited to 'client/usb_windows.cpp')
-rw-r--r--client/usb_windows.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/client/usb_windows.cpp b/client/usb_windows.cpp
index 640e91e..9e00a5d 100644
--- a/client/usb_windows.cpp
+++ b/client/usb_windows.cpp
@@ -103,7 +103,7 @@ static void kick_devices();
/// Entry point for thread that polls (every second) for new usb interfaces.
/// This routine calls find_devices in infinite loop.
-static void device_poll_thread(void*);
+static void device_poll_thread();
/// Initializes this module
void usb_init();
@@ -174,7 +174,7 @@ int register_new_device(usb_handle* handle) {
return 1;
}
-void device_poll_thread(void*) {
+void device_poll_thread() {
adb_thread_setname("Device Poll");
D("Created device thread");
@@ -203,7 +203,7 @@ static LRESULT CALLBACK _power_window_proc(HWND hwnd, UINT uMsg, WPARAM wParam,
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
-static void _power_notification_thread(void*) {
+static void _power_notification_thread() {
// 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
@@ -258,12 +258,8 @@ static void _power_notification_thread(void*) {
}
void usb_init() {
- if (!adb_thread_create(device_poll_thread, nullptr)) {
- fatal_errno("cannot create device poll thread");
- }
- if (!adb_thread_create(_power_notification_thread, nullptr)) {
- fatal_errno("cannot create power notification thread");
- }
+ std::thread(device_poll_thread).detach();
+ std::thread(_power_notification_thread).detach();
}
usb_handle* do_usb_open(const wchar_t* interface_name) {