projects
/
musl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
implement realpath directly instead of using procfs readlink
[musl]
/
src
/
thread
/
vmlock.c
1
#include "pthread_impl.h"
2
#include "fork_impl.h"
3
4
static volatile int vmlock[2];
5
volatile int *const __vmlock_lockptr = vmlock;
6
7
void __vm_wait()
8
{
9
int tmp;
10
while ((tmp=vmlock[0]))
11
__wait(vmlock, vmlock+1, tmp, 1);
12
}
13
14
void __vm_lock()
15
{
16
a_inc(vmlock);
17
}
18
19
void __vm_unlock()
20
{
21
if (a_fetch_add(vmlock, -1)==1 && vmlock[1])
22
__wake(vmlock, -1, 1);
23
}