Re: sem_open() returns ENOSPC
Re: sem_open() returns ENOSPC
- Subject: Re: sem_open() returns ENOSPC
- From: Jonas Maebe <email@hidden>
- Date: Sun, 18 Jul 2010 18:34:56 +0200
On 18 Jul 2010, at 18:30, Alastair Houghton wrote:
> On 18 Jul 2010, at 12:18, Jonas Maebe wrote:
>
>> 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).
>
> *However*, if you do this, you can't then obtain the semaphore by name from another process, since the name has been unlinked (it works just like the filesystem in this regard).
Since Norm said that he was using them because Darwin does not support unnamed semaphores (sem_init/sem_destroy), that shouldn't be an issue here.
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