in reply to While(1) using 100% CPU
Simply use an ordinary timed wait on the port: you're not going to lose transactions.
When any process “busy waits,” it consumes entire time-slices... unproductively. That's precisely opposite from what you want to be doing: your computer has other, more-important things to do. It has no way to know whether a very-busy process is doing something “useful.”