Polling is slow and burns CPU cycles. Especially in something like a text editor where there's not much processing going on, and more time is spent waiting for user input. So we shouldn't be read()ing or polling, and instead should be looking at something like select() (meh), or a full blown asynchronous library like libevent().
I'd personally prefer the second. It's cross-platform and picks the best event loop system per platform.
Polling is slow and burns CPU cycles. Especially in something like a text editor where there's not much processing going on, and more time is spent waiting for user input. So we shouldn't be
read()ing or polling, and instead should be looking at something likeselect()(meh), or a full blown asynchronous library likelibevent().I'd personally prefer the second. It's cross-platform and picks the best event loop system per platform.