
20 Jun
2009
20 Jun
'09
9:54 p.m.
Zachary Turner wrote:
Sorry for jumping into the middle of this. But shouldn't it only notify_one() if count is greater than or equal to 0? Not unconditionally. It's possible to initialize the semaphore with a negative count, and in that case a call to wait() should not unblock until the semaphore is 0 or higher.
Ummm... Interprocess models POSIX primitives and I see that #include <semaphore.h> int sem_init(sem_t *sem, int pshared, unsigned int value); semaphore value should be always positive, something that does not happen in Interprocess: interprocess_semaphore(int initialCount); So I think I should change interprocess constructor to an unsigned int. Best, Ion