add debugging log
[platform/core/uifw/libtdm.git] / 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;
        }