Re: How to use timeout in semaphore
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=iOWbeJT83IYhAimNhtRU/29CdQzlaMAIhdE9gbz3W7E=; b=PxrfdUYvN+bxeo3PhzE/aUSF0ShVNQxYkU+SuEK7cy4ojhDbbxd7vshY5qVfbfw5DB YZpGJtqRnA1oJ4/TWPf8ptW/0CDLhrhnHz9+d9N+2KlG1CD5enCJr533c3HkWTMU/MSv ljFL4szxixu7aXuDcpFgwQGmSR8i0bL3oWaXE= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=XmPHE5AFXYCCG6rYwfrSkABGQ7G+8Vo41jmuoTz9jjI5LuubLyfUBWPowYZN5dxjz7 Drs4kleRN4qTmnqYl9ll6acbXPsxtZwyh2hhp+ieFkFW+X3htLneKbeL2JfmEuPhwhB9 JEURcESoROfvfoNR+H8y9vtZXbmkZmyohRG/w= 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. _______________________________________________ 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...
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... This email sent to site_archiver@lists.apple.com
participants (1)
-
Eli Bach