-
Notifications
You must be signed in to change notification settings - Fork 167
Description
trying to open a two shared TTYPorts, but I am running into issues opening the second one, where I get an error with flock::lock_exclusive() -> "Unable to acquire exclusive lock on serial port" (which comes from flock). I don't see why TTYPort::open() unconditionally sets exclusive since given this scheme it seems impossible to open two shared ports using this lib.
open first as exclusive -> immediately set as non-exclusive -> open second as exclusive (fails)
I read the comment for that:
// Try to claim exclusive access to the port. This is performed even
// if the port will later be set as non-exclusive, in order to respect
// other applications that may have an exclusive port lock.but it doesn't make sense to me, because if we try to open a non-exclusive lock on a serial port that was previous locked as exclusive, the OS syscall should fail anyway.
This should be possible with some refactoring of port locking
This issue was ported from discussion #313