summaryrefslogtreecommitdiffstats
path: root/source/ap/ksh93/patches/ksh-20120801-locking.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/ksh93/patches/ksh-20120801-locking.patch')
-rw-r--r--source/ap/ksh93/patches/ksh-20120801-locking.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/ap/ksh93/patches/ksh-20120801-locking.patch b/source/ap/ksh93/patches/ksh-20120801-locking.patch
new file mode 100644
index 000000000..189d254d5
--- /dev/null
+++ b/source/ap/ksh93/patches/ksh-20120801-locking.patch
@@ -0,0 +1,26 @@
+diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.locking ksh-20120801/src/cmd/ksh93/include/jobs.h
+--- ksh-20120801/src/cmd/ksh93/include/jobs.h.locking 2014-06-27 15:51:07.144923719 +0200
++++ ksh-20120801/src/cmd/ksh93/include/jobs.h 2014-06-27 15:52:56.463272276 +0200
+@@ -149,15 +149,18 @@ extern struct jobs job;
+ #define vmbusy() 0
+ #endif
+
+-#define job_lock() (job.in_critical++)
++#define asoincint(p) __sync_fetch_and_add(p,1)
++#define asodecint(p) __sync_fetch_and_sub(p,1)
++
++#define job_lock() asoincint(&job.in_critical)
+ #define job_unlock() \
+ do { \
+ int sig; \
+- if (!--job.in_critical && (sig = job.savesig)) \
++ if (asodecint(&job.in_critical)==1 && (sig = job.savesig)) \
+ { \
+- if (!job.in_critical++ && !vmbusy()) \
++ if (!asoincint(&job.in_critical) && !vmbusy()) \
+ job_reap(sig); \
+- job.in_critical--; \
++ asodecint(&job.in_critical); \
+ } \
+ } while(0)
+