From cdc2c30e99f2fb3d65dfbc8ef73efd433a3f1966 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 26 Sep 2013 22:24:31 +0200 Subject: reverting semaphore lock changes from sources (r41ccd6d221da, rb28756e5ba29) semaphore locks have much higher overhead than initially presented in the "Semaphores in Plan9" paper. until the reason for it has been found out i will revert the changes. --- sys/src/ape/lib/ap/sparc/lock.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/src/ape/lib/ap/sparc/lock.c') diff --git a/sys/src/ape/lib/ap/sparc/lock.c b/sys/src/ape/lib/ap/sparc/lock.c index 5b1d72c46..91c0ba233 100644 --- a/sys/src/ape/lib/ap/sparc/lock.c +++ b/sys/src/ape/lib/ap/sparc/lock.c @@ -2,17 +2,19 @@ #include "../plan9/sys9.h" #include +int tas(int*); + void lock(Lock *lk) { - while(tas((int*)&lk->key)) + while(tas(&lk->val)) _SLEEP(0); } int canlock(Lock *lk) { - if(tas((int*)&lk->key)) + if(tas(&lk->val)) return 0; return 1; } @@ -20,5 +22,5 @@ canlock(Lock *lk) void unlock(Lock *lk) { - lk->key = 0; + lk->val = 0; } -- cgit v1.2.3