Eternal block of process with sem_wait ( )
I'm working on a project upon Ubuntu Linux distribution, and I'm intended to use the semaphore interface provided by <semaphore.h>. The actual problem is, that when having two processes, let's say A and B, that lock their critical sections with the same semaphore, let's say s, B tries to lock semaphore (sem_wait) and goes into the CS, A tries to lock semaphore (sem_wait) but is blocked, and then B locks and unlocks (sem_post) the semaphore a lot of times, while A is sitting actionless... Even when B ends, A does not respond, as it seems to be blocked by its sem_wait. I would be grateful if anyone had any idea about this (except bad memory handling and wrong initialization, etc).
Thanx for any response!