mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
230 B
15 lines
230 B
#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);
|
|
}
|
|
}
|
|
|