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/libc/sparc/lock.c | 41 ----------------------------------------- sys/src/libc/sparc/mkfile | 2 +- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 sys/src/libc/sparc/lock.c (limited to 'sys/src/libc/sparc') diff --git a/sys/src/libc/sparc/lock.c b/sys/src/libc/sparc/lock.c deleted file mode 100644 index c0966fcac..000000000 --- a/sys/src/libc/sparc/lock.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -void -lock(Lock *lk) -{ - int i; - - /* once fast */ - if(!_tas((int*)&lk->key)) - return; - /* a thousand times pretty fast */ - for(i=0; i<1000; i++){ - if(!_tas((int*)&lk->key)) - return; - sleep(0); - } - /* now nice and slow */ - for(i=0; i<1000; i++){ - if(!_tas((int*)&lk->key)) - return; - sleep(100); - } - /* take your time */ - while(_tas((int*)&lk->key)) - sleep(1000); -} - -int -canlock(Lock *lk) -{ - if(_tas((int*)&lk->key)) - return 0; - return 1; -} - -void -unlock(Lock *lk) -{ - lk->key = 0; -} diff --git a/sys/src/libc/sparc/mkfile b/sys/src/libc/sparc/mkfile index 6ef2cf55c..af2b18944 100644 --- a/sys/src/libc/sparc/mkfile +++ b/sys/src/libc/sparc/mkfile @@ -22,7 +22,7 @@ SFILES=\ vlop.s CFILES=\ - lock.c\ + cycles.c\ notejmp.c\ sqrt.c\ vlrt.c\ -- cgit v1.2.3