intel-iot-devkit/mraa — pull request #25 by barsuhn (2014-10-29 13:01:37+00:00)
Title: Make mraa_gpio_isr threading safe

There is no safe way to use dynamically allocated resources as args for the isr callback in mraa_gpio_isr. Since you don't know when the interrupt handling thread has terminated, you can not know when to safely deallocate the resource, your isr callback function might still be using.

I tried to explain this here: https://software.intel.com/en-us/forums/topic/534435#comment-1802969

My suggestion would be to pthread_join the thread in mraa_gpio_isr_exit. I could not test this code. I even could not figure out how to compile using the cross compiler on my Mac. So please just take this as a suggestion.