On Mon, Jun 01, 2009 at 06:33:42PM +0300, Vlad Galu wrote: > 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?
You may want to read the comments in /usr/src/lib/libc/gen/sem.c regarding sem_init(). But yes, the man page is somewhat unclear and I'm not sure the last paragraph is still totally accurate. > Thanks, > Vlad -cpghost. -- Cordula's Web. http://www.cordula.ws/ _______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"