View topic - Semaphore Locks?
Semaphore Locks?
2 posts
• Page 1 of 1
Semaphore Locks?
Hello,
We are using QNX 6.3.0 service pack 3. We have a binary semaphore that is accessed by several processes (about 15) to access a shared memory area. Processes have 7 different priorities (so some of them have same priorities). While reviewing the code, I found out that some functions access the shared memory area without locking/unlocking the semaphore. When I added proper locking of the semaphore and then accessing the shared memory area and then releasing the semaphore as is done with all the other functions, we end up with all the processes get hang waiting for the semaphore to unlock. There is no obvious locking and then not unlocking errors.
My question is, is there a known limitations about binary semaphores that I am not aware of?
Thanks for any help.
Kind Regards,
Oburak.
We are using QNX 6.3.0 service pack 3. We have a binary semaphore that is accessed by several processes (about 15) to access a shared memory area. Processes have 7 different priorities (so some of them have same priorities). While reviewing the code, I found out that some functions access the shared memory area without locking/unlocking the semaphore. When I added proper locking of the semaphore and then accessing the shared memory area and then releasing the semaphore as is done with all the other functions, we end up with all the processes get hang waiting for the semaphore to unlock. There is no obvious locking and then not unlocking errors.
My question is, is there a known limitations about binary semaphores that I am not aware of?
Thanks for any help.
Kind Regards,
Oburak.
- oburak
- Active Member
- Posts: 17
- Joined: Tue Nov 24, 2009 2:39 pm
Re: Semaphore Locks?
You might want to use mutex as they respect priorities.
My first guess is that your code is missing an unlock somewhere. I find that wrapping mutex/semaphore in a C++ object makes it safer in that regard.
My first guess is that your code is missing an unlock somewhere. I find that wrapping mutex/semaphore in a C++ object makes it safer in that regard.
- mario
- QNX Master
- Posts: 4132
- Joined: Sun Sep 01, 2002 1:04 am
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests