sdm: Cancel display event thread on exit.

- Send a cancellation request to display event thread before waiting
  for it join. This thread waits for poll to return indefinitely
  which may not return if all of the events (vsync etc) are in
  disabled state.
- Drop this call for Android for now as this api is not supported in
  bionic.
- Fix GetVSyncState return value.
- Fix pwrite return value in case of set on idle time out.

Change-Id: I7da5be4c8a77fa986450dedb914fa2dba2751da9
diff --git a/sdm/libs/utils/sys.cpp b/sdm/libs/utils/sys.cpp
index dd62d6e..03310ff 100644
--- a/sdm/libs/utils/sys.cpp
+++ b/sdm/libs/utils/sys.cpp
@@ -38,6 +38,10 @@
 
 #ifndef SDM_VIRTUAL_DRIVER
 
+int PthreadCancel(pthread_t /* thread */) {
+  return 0;
+}
+
 // Pointer to actual driver interfaces.
 Sys::ioctl Sys::ioctl_ = ::ioctl;
 Sys::open Sys::open_ = ::open;
@@ -48,6 +52,7 @@
 Sys::fopen Sys::fopen_ = ::fopen;
 Sys::fclose Sys::fclose_ = ::fclose;
 Sys::getline Sys::getline_ = ::getline;
+Sys::pthread_cancel Sys::pthread_cancel_ = PthreadCancel;
 
 #else
 
@@ -71,6 +76,7 @@
 Sys::fopen Sys::fopen_ = virtual_fopen;
 Sys::fclose Sys::fclose_ = virtual_fclose;
 Sys::getline Sys::getline_ = virtual_getline;
+Sys::pthread_cancel Sys::pthread_cancel_ = ::pthread_cancel;
 
 #endif  // SDM_VIRTUAL_DRIVER