diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-26 22:24:31 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-26 22:24:31 +0200 |
commit | cdc2c30e99f2fb3d65dfbc8ef73efd433a3f1966 (patch) | |
tree | 5c3d5a6a42311f09444ca34d09bfebc78e08f5a3 /sys/src/libc/68020 | |
parent | b4cdfc6c5517390d6be05b2c01e56bacc9e85ea8 (diff) |
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.
Diffstat (limited to 'sys/src/libc/68020')
-rw-r--r-- | sys/src/libc/68020/lock.c | 41 | ||||
-rw-r--r-- | sys/src/libc/68020/mkfile | 2 |
2 files changed, 1 insertions, 42 deletions
diff --git a/sys/src/libc/68020/lock.c b/sys/src/libc/68020/lock.c deleted file mode 100644 index c0966fcac..000000000 --- a/sys/src/libc/68020/lock.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <u.h> -#include <libc.h> - -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/68020/mkfile b/sys/src/libc/68020/mkfile index d486d74f7..bdd359164 100644 --- a/sys/src/libc/68020/mkfile +++ b/sys/src/libc/68020/mkfile @@ -26,7 +26,7 @@ SFILES=\ vlop.s\ CFILES=\ - lock.c\ + cycles.c\ notejmp.c\ vlrt.c\ |