OSDN Git Service

Fix the issue that the HWCLock thread will not exit.
authorZhongmin Wu <zhongmin.wu@intel.com>
Mon, 30 Oct 2017 07:40:23 +0000 (15:40 +0800)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Thu, 2 Nov 2017 20:36:33 +0000 (13:36 -0700)
The displaymanager thread is blocked in "read" call,
so it will never get chance to disable HWClock.

As we already use "select" to receive the "POLL IN" event of
the fd, we had better to set the "Non Blocking" flag on.

Jira: None.
Test: HWCLock thread is closed on Android after booting to
      homescreen.
Signed-off-by: Zhongmin Wu <zhongmin.wu@intel.com>
wsi/drm/drmdisplaymanager.cpp

index 18d9f2b..334c529 100644 (file)
@@ -130,6 +130,9 @@ bool DrmDisplayManager::Initialize() {
     return true;
   }
 
+  int flags = fcntl(hotplug_fd_, F_GETFL, 0);
+  fcntl(hotplug_fd_, F_SETFL, flags | O_NONBLOCK);
+
   fd_handler_.AddFd(hotplug_fd_);
 
   if (!InitWorker()) {