Handle multiple events in gpio : <p>I'm new to embedded programming and I apologise in advance for any confusion.</p>

<p>I need to handle multiple events from different devices connected to a gpio. These events need to be monitored continually. This means that after one event is generated and handled, the code needs to keep monitoring the device for other events.</p>

<p>I understand the concept of interruptions and polling in Linux (the kernel gets an interruption and dispatch it to the handler which goes on up to the callee of an epoll which is inside an infinite loop while(1)-like). </p>

<p>This is fine for one-time, single-event toy models. In a embedded system with limited resources such as the <a href="https://www.digikey.com/eewiki/display/linuxonarm/AT91SAM9x5#AT91SAM9x5-LinuxKernel" rel="nofollow noreferrer">AT91SAM9x5</a> that runs at 400mhz and has 128mb of ram what can I do ? I believe that the while(1)-like pattern isn't the best choice. I've heard good things about thread pool solution but at the heart of each thread don't we find a while(1) ? </p>

<p>What are my options to attack this problem ?</p>

<p>Thank you in advance !</p>
