Re: sem_open() returns ENOSPC
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On 15 Jul 2010, at 01:50, Norm Green wrote:
Well that might account for the problem. Since I need (but do not have) unnamed POSIX semaphores in Darwin, I generate a random name for each semaphore but unlink. Sounds like I need to find some way to allocate semaphores with a well known name and then unlink it before attempting to use the name again.
The easiest way to solve this is to immediately call sem_unlink() after you've called sem_open(). The semaphore will remain in existence until you call sem_close(). Since all file descriptors are automatically closed when a process terminates (either normally or abnormally), this prevents all semaphore leaking (unless you'd be terminated between the sem_open() and sem_unlink(), but that's very unlikely). Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jonas Maebe