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.
This commit is contained in:
parent
d28913a9e6
commit
9505cd15a6
4 changed files with 82 additions and 123 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue