| plan 9 kernel history: overview | file list | diff list |
1995/0109/port/taslock.c (diff list | history)
| 1995/0109/sys/src/9/port/taslock.c:1,93 – 1995/0110/sys/src/9/port/taslock.c:1,66 (short | long | prev | next) | ||
| 1992/0222 | #include "u.h" | |
| 1992/0321 | #include "../port/lib.h" | |
| 1992/0222 | #include "mem.h" #include "dat.h" #include "fns.h" #include "../port/error.h" void lock(Lock *l) { | |
| 1995/0108 |
| |
| 1995/0110 | if(tas(&l->key) == 0) return; | |
| 1995/0108 |
| |
| 1995/0110 | for(;;){ while(l->key) ; | |
| 1995/0108 | if(tas(&l->key) == 0) return; | |
| 1995/0110 | } | |
| 1995/0108 | ||
| 1993/1204 |
| |
| 1995/0110 | void ilock(Lock *l) { ulong x; x = splhi(); if(tas(&l->key) == 0){ l->sr = x; | |
| 1993/1204 | return; | |
| 1995/0110 | } | |
| 1993/0830 | for(;;){ | |
| 1994/0808 | while(l->key) ; | |
| 1993/0830 |
| |
| 1995/0110 | if(tas(&l->key) == 0){ l->sr = x; | |
| 1992/0222 | return; | |
| 1995/0110 | } | |
| 1992/0222 | } } | |
| 1995/0109 | int canlock(Lock *l) | |
| 1994/0322 | { | |
| 1995/0109 |
| |
| 1994/0323 | ||
| 1995/0109 |
| |
| 1994/0323 |
| |
| 1995/0109 |
| |
| 1994/0322 |
| |
| 1992/0222 | if(tas(&l->key)) return 0; | |
| 1995/0110 | ||
| 1992/0222 | return 1; } void unlock(Lock *l) { | |
| 1995/0108 |
| |
| 1995/0109 | l->key = 0; | |
| 1994/0322 | } void | |
| 1995/0109 |
| |
| 1994/0322 | iunlock(Lock *l) { ulong sr; sr = l->sr; | |
| 1995/0109 |
| |
| 1995/0110 | l->key = 0; | |
| 1994/0322 | splx(sr); | |
| 1992/0222 | } | |