Judging by this you need to look at the API a bit differently.
The only way out of having a concurrent thread handle the interrupt is to use a blocking call -- for example, you could poll()
the sysfs interface. The wiringPi equivalent of this is presumably waitForInterrupt()
.
Here's the issue. Either a process:
Is single threaded and must wait for an interrupt to occur via a blocking call, OR
Is multi-threaded and handles interrupts on a dedicated thread concurrently.
The second one is really an elaboration of the first, since the handler thread is waiting on blocking calls in the background. However, this is probably a step closer to what you are looking for since it can be adapted to do things synchronously with locks (or asynchronously with signals) -- although you might have to implement the thread yourself to do that. Again, glancing at that wiringPi page it has "a simplified interface to the Linux implementation of Posix threads" which you could presumably make use of (together with waitForInterrupt()
) for this.