Skip to content

Allow opening two shared TTYPorts #314

@rockboynton

Description

@rockboynton

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions