Re: How to use timeout in semaphore
Re: How to use timeout in semaphore
- Subject: Re: How to use timeout in semaphore
- From: Eli Bach <email@hidden>
- Date: Sun, 21 Dec 2008 23:48:13 -0800
On Dec 21, 2008, at 11:00 PM, Rakesh Singhal wrote:
Hi all
I am using semaphore using semget, semop, semctl APIs. I have written
2 APIs similar like semwait and sempost using semop. Now I want to use
semwait but it is blocking call and I want to get timeout in some
defined time if there sempost is not called.
Please suggest me.
From looking at the man page for sem_wait(), I would suggest setting
a timer to send a signal to the process, and then noticing that
sem_wait exitted because of the signal and not because the semaphore
was released.
It is left as an exercise for the reader to determine what signal to
best to send, handling case where the signal interrupts other system
calls, etc...
_______________________________________________
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