diff options
author | Russ Cox <rsc@swtch.com> | 2020-01-14 18:03:05 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2020-01-14 18:04:00 -0500 |
commit | 9505cd15a64933bf58ec50548339cf98b1854646 (patch) | |
tree | e3f519f753b124a27780470cf483f9f4a550a9d9 /src/lib9/fmtlock2.c | |
parent | d28913a9e6609fef96f5baf6e9f4d5055ede744c (diff) | |
download | plan9port-9505cd15a64933bf58ec50548339cf98b1854646.tar.gz plan9port-9505cd15a64933bf58ec50548339cf98b1854646.tar.bz2 plan9port-9505cd15a64933bf58ec50548339cf98b1854646.zip |
lib9: make formatting lock-free again
First use of <stdatomic.h>.
We will see if any supported systems don't have it yet.
(C11 was so last decade.)
Fixes #338.
Diffstat (limited to 'src/lib9/fmtlock2.c')
-rw-r--r-- | src/lib9/fmtlock2.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/lib9/fmtlock2.c b/src/lib9/fmtlock2.c index b755daa3..d711e6d4 100644 --- a/src/lib9/fmtlock2.c +++ b/src/lib9/fmtlock2.c @@ -1,28 +1,16 @@ #include <u.h> #include <libc.h> -static RWLock fmtlock; +static Lock fmtlock; void -__fmtrlock(void) +__fmtlock(void) { - rlock(&fmtlock); + lock(&fmtlock); } void -__fmtrunlock(void) +__fmtunlock(void) { - runlock(&fmtlock); -} - -void -__fmtwlock(void) -{ - wlock(&fmtlock); -} - -void -__fmtwunlock(void) -{ - wunlock(&fmtlock); + unlock(&fmtlock); } |