platform_system_core/adb/client
Spencer Low 84fc27159a adb: win32: fix Ctrl-C of adb server nodaemon
On Windows, when running adb server nodaemon and pressing Ctrl-C,
adb_server_cleanup (an atexit handler) would call kick_all_transports()
which would eventually fail a CHECK because the current thread was not
equal to the main thread. This is because Ctrl-C is implemented in
Windows by the OS creating a new thread in the process and calling the
Ctrl-C handler from there.

The CHECK fail would print out the CHECK expression and call abort()
which would record a crash in the Windows Event Log, plus would
potentially upload a crashdump to Microsoft's Watson service.

This might be a regression from d51c6df1ef.

The fix is to share more code between platforms, removing the call to
Win32 SetConsoleCtrlHandler() and just use the C Runtime's signal()
implementation which is built upon SetConsoleCtrlHandler(). The signal
handler still ends up being called from another thread, but the handler
is thread-safe enough so this seems to work.

Test: On Win10 and Vista, run adb server nodaemon and then try Ctrl-C,
Ctrl-Break and close console window.

Change-Id: I6603970616098d2b3ce68f2a3d4e5515ec859811
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2018-08-25 23:46:48 -07:00
..
adb_client.cpp [adb] Modernize codebase by replacing NULL with nullptr 2018-07-13 18:21:00 -07:00
adb_client.h Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
adb_install.cpp Fix MacOS SDK build error caused by deprecated stl call. 2018-08-21 19:25:01 +01:00
adb_install.h Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
auth.cpp adb: report connection status when we're unauthorized. 2018-08-08 17:40:15 -07:00
bugreport.cpp adb: win32: fix Unicode console output 2018-07-30 19:53:23 -07:00
bugreport.h adb: switch over to Android.bp. 2018-02-28 15:29:50 -08:00
commandline.cpp Merge "Integrate adb with fastdeploy" 2018-08-21 06:28:49 +00:00
commandline.h Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
console.cpp adb: switch over to Android.bp. 2018-02-28 15:29:50 -08:00
fastdeploy.cpp Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
fastdeploy.h Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
fastdeploycallbacks.cpp Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
fastdeploycallbacks.h Integrate adb with fastdeploy 2018-08-06 13:57:47 +01:00
file_sync_client.cpp adb: split file_sync_service.h into client and daemon parts. 2018-07-25 18:08:32 -07:00
file_sync_client.h adb: split file_sync_service.h into client and daemon parts. 2018-07-25 18:08:32 -07:00
line_printer.cpp [adb] Modernize codebase by replacing NULL with nullptr 2018-07-13 18:21:00 -07:00
line_printer.h adb: switch over to Android.bp. 2018-02-28 15:29:50 -08:00
main.cpp adb: win32: fix Ctrl-C of adb server nodaemon 2018-08-25 23:46:48 -07:00
transport_mdns.cpp adb: remove fdevent_install, fdevent_remove. 2018-05-22 14:54:49 -07:00
usb_dispatch.cpp adb: fix darwin build break. 2017-05-10 13:58:51 -07:00
usb_libusb.cpp adb: Have device usb_handle return io size 2018-07-17 11:53:30 -07:00
usb_linux.cpp Merge changes I31e444f3,If07ff05f,If3ba190d 2018-07-17 22:35:36 +00:00
usb_osx.cpp adb: Have device usb_handle return io size 2018-07-17 11:53:30 -07:00
usb_windows.cpp Merge changes I31e444f3,If07ff05f,If3ba190d 2018-07-17 22:35:36 +00:00