Sign in
mojo
/
mojo
/
HEAD
/
.
/
fusl
/
src
/
thread
/
__lock.c
blob: f5e1377cfa13a2b5443f2970c9264783b796c9f8 [
file
] [
log
] [
blame
]
#include
"pthread_impl.h"
void
__lock
(
volatile
int
*
l
)
{
if
(
libc
.
threads_minus_1
)
while
(
a_swap
(
l
,
1
))
__wait
(
l
,
l
+
1
,
1
,
1
);
}
void
__unlock
(
volatile
int
*
l
)
{
if
(
l
[
0
])
{
a_store
(
l
,
0
);
if
(
l
[
1
])
__wake
(
l
,
1
,
1
);
}
}