Skip navigation.
Home
The QNX Community Portal

View topic - How to avoid multiple application accessing same port.

How to avoid multiple application accessing same port.

For discussion of realtime and/or embedded programming.

How to avoid multiple application accessing same port.

Postby garyritu » Fri Nov 13, 2009 4:38 am

Hi All,
I am using standard serial driver devc-ser8250 for serial communication with my hardware. I have observed that if first application is accessing port say /dev/ser1 then driver gives the handle for port sending /receive. But if another application also trys to open same port ( /dev/ser1) then driver gives handle for same port.
How to avoid multiple application access to same port. Also would like to inform that devc-ser8250 driver is based on io-char library. So developer does not have much control on code (there is no open(), close() etc calls in code).
garyritu
Active Member
 
Posts: 58
Joined: Fri May 22, 2009 7:09 am

RE: How to avoid multiple application accessing same port.

Postby anvesh » Fri Nov 13, 2009 5:14 am

Hi All,
On Windows, once a port is open by one application, no other application have access to the same port. I too have observed in case of QNX, its not possible. Any explanation for this is highly appreciated.
anvesh
Active Member
 
Posts: 31
Joined: Wed Dec 03, 2008 6:57 am

RE: How to avoid multiple application accessing same port.

Postby maschoen » Fri Nov 13, 2009 4:11 pm

Multiple threads or processes opening a device multiple times is correct and important Posix behavior. If you want to prevent this, you need a mechanism to prevent conflicts.
maschoen
QNX Master
 
Posts: 2644
Joined: Wed Jun 25, 2003 5:18 pm

RE: How to avoid multiple application accessing same port.

Postby mario » Fri Nov 13, 2009 6:07 pm

In QNX4 there was a way to determined if the serial port was already opened. I guess in QNX6 one could do what pidin fd does to determined if someone else has opened the port.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 3 guests