I would like to have a thread read the state of an input pin while also having an event handler for it. The reason for this is that I am exposing an interface to an external app which needs to be able to both ask for the state of a pin and receive information about pin state changes. However, since my thread is busy waiting for input from the external app on a socket I cannot have the event handler execute in the thread context. But I cannot have the GPIO service connected to both the main thread and my connection thread at the same time.
Is there any way around this which does not encompass making some low level messaging (https://docs.legato.io/latest/c_messaging.html#c_messagingClientMultithreading) between the connection thread and the main thread?
For all other API’s I have currently in use I can have the event handler in the main thread context which then can send the event information on all open sockets. But this doesn’t work for GPIO.