]> git.itanic.dy.fi Git - log-plotter/commit
main: Fix busy loop with reading
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 30 Sep 2013 18:09:07 +0000 (21:09 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 30 Sep 2013 18:09:07 +0000 (21:09 +0300)
commit9719680d66d26ab962426dc75672f0f9d049ba18
tree208071328e9e4999ff7ec9a35147fe67169f59d1
parentf6565fd6843ae5d597f850f01219e5a567cfb814
main: Fix busy loop with reading

As the baud.c opens the serial device with O_NBLOCK flag, read will
just return immediately when there is nothing to read. That basically
makes the read loop a a busy loop, consuming one CPU core fully at all
times.

Fix the problem by using epoll to wait until something becomes
available on the serial port to read.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
main.c