add debugging log 38/167338/3
authorBoram Park <boram1288.park@samsung.com>
Wed, 17 Jan 2018 01:30:28 +0000 (10:30 +0900)
committerBoram Park <boram1288.park@samsung.com>
Wed, 17 Jan 2018 06:48:57 +0000 (15:48 +0900)
Change-Id: I7c758cba21e6398890e7441071b63d6354425f65

src/tdm_thread.c

index 22d67af..f71f3a1 100644 (file)
@@ -245,7 +245,8 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop)
        tdm_private_thread *private_thread;
        tdm_thread_cb_base *base;
        char buffer[1024];
-       unsigned int len, i;
+       unsigned int i;
+       int len;
 
        /* DON'T check TDM_MUTEX_IS_LOCKED here */
 
@@ -255,16 +256,23 @@ tdm_thread_handle_cb(tdm_private_loop *private_loop)
        private_thread = private_loop->private_thread;
        private_display = private_loop->dpy;
 
-       len = read(private_thread->pipe[0], buffer, sizeof buffer);
+       do {
+               len = read(private_thread->pipe[0], buffer, sizeof buffer);
+       } while (len < 0 && errno == EINTR);
 
        if (tdm_debug_module & TDM_DEBUG_THREAD)
                TDM_INFO("fd(%d) read length(%d)", private_thread->pipe[0], len);
 
+       if (len < 0) {
+               TDM_ERR("read failed: errno(%d), len(%d) %m", errno, len);
+               return TDM_ERROR_OPERATION_FAILED;
+       }
+
        if (len == 0)
                return TDM_ERROR_NONE;
 
        if (len < sizeof * base) {
-               TDM_NEVER_GET_HERE();
+               TDM_ERR("read failed: len(%d)", len);
                return TDM_ERROR_OPERATION_FAILED;
        }