|
|
Message-ID: <alpine.LNX.2.00.1408272249230.6544@monopod.intra.ispras.ru>
Date: Wed, 27 Aug 2014 23:06:14 +0400 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: sem_getvalue conformance considerations
On IRC Rich noted that I've too conveniently elided cancellation, so here's how
I think cancellation handler should look like:
val = sem->val[0];
while (val < 0) {
/* We believe we are a waiter that no sem_post has "seen". */
oldval = val;
if ((val = a_cas(sem->val, val, val+1)) == oldval)
return;
}
/* We are a waiter, and a non-negative val[0] indicates that one sem_post
* noticed us. Consume the corresponding wake count increment. */
a_dec(sem->val+1);
Alexander
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.