gpio: do not join if the thread is null 36/165636/2
authorSegwon <segwon.han@samsung.com>
Wed, 3 Jan 2018 03:00:19 +0000 (12:00 +0900)
committerSegwon <segwon.han@samsung.com>
Wed, 3 Jan 2018 03:06:39 +0000 (12:06 +0900)
Change-Id: Ib1dafd777acaa7da520ac7aae050a05b1d607dca
Signed-off-by: Segwon <segwon.han@samsung.com>
src/interface/peripheral_interface_gpio.c
src/peripheral_gpio.c

index c8dd33bc53593dc6a130216538d7ace2b0b14c23..2695a86d98ea00b2e02477c09ed3639b898d75e2 100644 (file)
@@ -259,7 +259,11 @@ int peripheral_interface_gpio_set_interrupted_cb(peripheral_gpio_h gpio, periphe
 int peripheral_interface_gpio_unset_interrupted_cb(peripheral_gpio_h gpio)
 {
        gpio->cb_info.status = GPIO_INTERRUPTED_CALLBACK_UNSET;
-       g_thread_join(gpio->cb_info.thread);
+
+       if (gpio->cb_info.thread != NULL) {
+               g_thread_join(gpio->cb_info.thread);
+               gpio->cb_info.thread = NULL;
+       }
 
        return PERIPHERAL_ERROR_NONE;
 }
\ No newline at end of file
index e5a3d8c8701841d27d8794cde851c5822a49f2c8..0b4252c6562aea699aa9fd03d2d4e7cc5b806cf4 100644 (file)
@@ -86,6 +86,7 @@ int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio)
                return ret;
        }
 
+       handle->cb_info.thread = NULL;
        *gpio = handle;
 
        return PERIPHERAL_ERROR_NONE;