From: Segwon Date: Wed, 3 Jan 2018 03:00:19 +0000 (+0900) Subject: gpio: do not join if the thread is null X-Git-Tag: submit/tizen/20180103.062104~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c754a6e87dc23a1958a84acac4f7beff82f43ca;p=platform%2Fcore%2Fapi%2Fperipheral-io.git gpio: do not join if the thread is null Change-Id: Ib1dafd777acaa7da520ac7aae050a05b1d607dca Signed-off-by: Segwon --- diff --git a/src/interface/peripheral_interface_gpio.c b/src/interface/peripheral_interface_gpio.c index c8dd33b..2695a86 100644 --- a/src/interface/peripheral_interface_gpio.c +++ b/src/interface/peripheral_interface_gpio.c @@ -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 diff --git a/src/peripheral_gpio.c b/src/peripheral_gpio.c index e5a3d8c..0b4252c 100644 --- a/src/peripheral_gpio.c +++ b/src/peripheral_gpio.c @@ -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;