aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-12 11:18:33 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-12 11:18:33 +0200
commit1d7827e613663cf3bc504672a0ddbea695198e74 (patch)
tree06cf4e549d931c079d70d305cede7e4beba6b10d
parentdist (diff)
downloadcmdipc-1d7827e613663cf3bc504672a0ddbea695198e74.tar.gz
cmdipc-1d7827e613663cf3bc504672a0ddbea695198e74.tar.bz2
cmdipc-1d7827e613663cf3bc504672a0ddbea695198e74.tar.xz
race condition1.1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--info/cmdipc.texinfo8
-rwxr-xr-xsrc/__main__.py12
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()