From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7347 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: Resuming work on new semaphore Date: Mon, 6 Apr 2015 00:07:37 +0300 (MSK) Message-ID: References: <20150402013006.GA1108@brightrain.aerifal.cx> <20150402152642.GW6817@brightrain.aerifal.cx> <20150402231457.GC6817@brightrain.aerifal.cx> <20150405190214.GF6817@brightrain.aerifal.cx> <20150405202314.GG6817@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: ger.gmane.org 1428268072 15122 80.91.229.3 (5 Apr 2015 21:07:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 5 Apr 2015 21:07:52 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7360-gllmg-musl=m.gmane.org@lists.openwall.com Sun Apr 05 23:07:52 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Yerlm-0003n1-SV for gllmg-musl@m.gmane.org; Sun, 05 Apr 2015 23:07:51 +0200 Original-Received: (qmail 18195 invoked by uid 550); 5 Apr 2015 21:07:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18175 invoked from network); 5 Apr 2015 21:07:49 -0000 In-Reply-To: <20150405202314.GG6817@brightrain.aerifal.cx> User-Agent: Alpine 2.11 (LNX 23 2013-08-11) Xref: news.gmane.org gmane.linux.lib.musl.general:7347 Archived-At: On Sun, 5 Apr 2015, Rich Felker wrote: > So if cancellation was pending _before_ the call to sem_wait, then > sem_wait has to honor it. But there is no requirement that entry to > the sem_wait function be "atomic" with becoming a waiter on the > semaphore, and of course this is impossible to satisfy or even > specify. Thanks! One other thing to consider. In the absence of concurrent operations on the semaphore, return value of sem_getvalue should be equal to the number of times sem_trywait will indicate success when called repeatedly. So if the implementation performs post-stealing in trywait, it should return the higher bound as semaphore value. Likewise for timedwait. Alexander