The key idea to making this work is finding a method to ensure exclusive access by thread 1 to the UART receive register. One approach is to prevent pre-emption by disablng interrupts; however, consider what would happen if no character arrived or simply arrived after a substantial delay. What is needed is a mechanism to block only those threads which are competing for access to the UART receive hardware. The solution is to use a semphore: