Re: sem_open() returns ENOSPC
Re: sem_open() returns ENOSPC
- Subject: Re: sem_open() returns ENOSPC
- From: Norm Green <email@hidden>
- Date: Sun, 18 Jul 2010 08:08:36 -0700
Excellent idea Jonas, thanks much.
Norm Green
On 7/18/2010 4:18 AM, Jonas Maebe wrote:
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden