From 1d7827e613663cf3bc504672a0ddbea695198e74 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 12 Aug 2014 11:18:33 +0200 Subject: race condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- info/cmdipc.texinfo | 8 ++++---- src/__main__.py | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/info/cmdipc.texinfo b/info/cmdipc.texinfo index 5739522..3f5cbba 100644 --- a/info/cmdipc.texinfo +++ b/info/cmdipc.texinfo @@ -549,10 +549,10 @@ slash. [sysv] enter: P(s), Z(s) - if P(m, nonblocking) does not fail: - if s.value = 0: - s.value := threshold - V(m) + P(m) + if s.value = 0: + s.value := threshold + V(m) [posix] create: (x, c, q) := (S(1), S(0), S(0)) diff --git a/src/__main__.py b/src/__main__.py index b835aee..114c9af 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -286,14 +286,10 @@ try: if not use_posix: s.P(timeout) s.Z(timeout) - try: - m.P(0) - except ipc.BusyError: - pass - else: - if s.value == 0: - s.set_value(threshold) - m.V() + m.P() + if s.value == 0: + s.set_value(threshold) + m.V() else: x.P(timeout) c.V() -- cgit v1.2.3-70-g09d2