Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
musl
/
92f8396b0c8e4f146563b87f46137484cfb36e31
/
.
/
src
/
thread
/
__lock.c
blob: 2f345ae7af02153c1bffbd5cbfc0f0be860127a6 [
file
] [
log
] [
blame
]
#include
"pthread_impl.h"
void
__lock
(
volatile
int
*
l
)
{
while
(
a_swap
(
l
,
1
))
__wait
(
l
,
l
+
1
,
1
,
1
);
}
void
__unlock
(
volatile
int
*
l
)
{
a_store
(
l
,
0
);
if
(
l
[
1
])
__wake
(
l
,
1
,
1
);
}