Wake the eventloop up when requesting deinitialize 06/259506/1
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 9 Jun 2021 06:27:19 +0000 (15:27 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 9 Jun 2021 06:27:27 +0000 (15:27 +0900)
Change-Id: If0145571a4d98caeb29111beb2029ea030ba3ba4

src/vine-event-loop.cpp

index b4378c5024a186b088f697a38fa233f3026f3525..9c1bbcc5109a4160a39eec0d91fcae4cd461fbd7 100644 (file)
@@ -124,10 +124,22 @@ int vine_event_loop_start()
        return VINE_ERROR_NONE;
 }
 
+static void _vine_event_loop_wake_up()
+{
+       uint64_t v = 1;
+       int fd = eventfd(0, 0);
+
+       VINE_LOGD("fd[%d] to wake the eventloop up");
+       vine_event_loop_add_io_handler(fd, VINE_POLLOUT, NULL, NULL);
+       if (write(fd, &v, sizeof(v)) == -1)
+               VINE_LOGE("Write error(%d)", errno);
+}
+
 void vine_event_loop_stop()
 {
        VINE_LOGD("vine_event_loop_stop");
        __cleanup = true;
+       _vine_event_loop_wake_up();
        pthread_join(__vine_event_loop_tid, NULL);
        __vine_event_loop_tid = 0;
 }