If implemented correctly, the semaphore set/get code will prevent the possibility of "deadlock" or situation in which (2) pieces of code can think that they can have access to the resource (serial port data). If just using a global flag that can be set/reset from more than one place, then you could have a situation where one piece of code reads the flag, but before it executes a branch based onthe value, an interrupt can occur that might itself change the global flag value, and thus the first code function erronesouly assumes it knows the state of the global flag when it has in fact, been changed right under its very "nose". Depending upon the architecture of your software, this situation may be more, or less likely to occur.