What is the best way to prevent multiple access of a serial port across multiple processes using C\C++ on Linux.
Assuming each process can access the serial port at any time. What is the most efficient way to restrict to only one process can access the a serial port at a time. Once the serial port is in use, I would like other process to be blocked. Once the current process release the port the next process can take over the serial port base on first come first serve rule.