This demonstrates how you would build an event loop using the select call. Should compile fine on linux.