Hello,
According to sem_init(3), we can't have shared unnamed semaphores.
However, the following code snippet seems to work just fine:
-- cut here --
sem_t semaphore;
if (sem_init(&semaphore, 1, 10) < 0)
std::cout << "Couldn't init semaphore: " <<
strerror(errno) << std::endl;
if (sem_wait(&semaphore) < 0)
std::cout << "Couldn't decrement semaphore: " <<
strerror(errno) << std::endl;
int val;
sem_getvalue(&semaphore, &val);
std::cout << "Value is " << val << std::endl;
-- and here --
Is this a case where sem_init() silently reports success, or should be
the man page get an update?
Thanks,
Vlad
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[email protected]"