When I tried to use g_io_channels with FIFO files in sqrl, I found that one CPU would be pegged immediately a request was received over the FIFO. I don't know why but I'm pretty sure it's related to g_io_channels. To prove it I built this test client and server.
The client simply opens the FIFO and sends a message to it.
The server uses the same method as sqrl to open the FIFO, add it to an event loop, then starts off the event loop.
I see exactly the same response with this client and server than I did with sqrl:
- On startup, 0% CPU
- The first request brings the CPU to 100%
- CPU stays at 100% until the server is killed
This should build on any linux box that has the GTK-2.0 DEV libraries installed.
The build steps are pretty simple since there is already a Makefile in place:
cd src
make
If you know why the CPU pegs to 100% in this configuration, and know the solution, please share. Feel free to ping me via github or clone this project, fix it, and send me a pull request. Thank you!