gpio: make mraa_gpio_isr_exit block until the interrupt handling thread is terminated.
Signed-off-by: Bernd Barsuhn <bernd.barsuhn@me.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
9235ed178a
commit
2a851d7cc7
@@ -300,9 +300,10 @@ mraa_gpio_isr_exit(mraa_gpio_context dev)
|
||||
// stop isr being useful
|
||||
ret = mraa_gpio_edge_mode(dev, MRAA_GPIO_EDGE_NONE);
|
||||
|
||||
if ((dev->thread_id != 0) &&
|
||||
(pthread_cancel(dev->thread_id) != 0)) {
|
||||
ret = MRAA_ERROR_INVALID_HANDLE;
|
||||
if ((dev->thread_id != 0)) {
|
||||
if ((pthread_cancel(dev->thread_id) != 0) || (pthread_join(dev->thread_id, NULL) != 0)) {
|
||||
ret = MRAA_ERROR_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
// close the filehandle in case it's still open
|
||||
|
||||
Reference in New Issue
Block a user