mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-24 05:18:30 +00:00
Implement POSIX threads API
This commit is contained in:
parent
af24f21556
commit
9be364d40a
95 changed files with 6029 additions and 317 deletions
|
@ -16,26 +16,26 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/futex.internal.h"
|
||||
#include "libc/thread/thread.h"
|
||||
|
||||
int cthread_memory_wait32(int* addr, int val, const struct timespec* timeout) {
|
||||
size_t size;
|
||||
if (IsLinux() /* || IsOpenbsd() */) {
|
||||
return _futex_wait(addr, val, timeout);
|
||||
if (IsLinux() || IsOpenbsd()) {
|
||||
return _futex_wait_public(addr, val, timeout);
|
||||
} else {
|
||||
return sched_yield();
|
||||
}
|
||||
}
|
||||
|
||||
int cthread_memory_wake32(int* addr, int n) {
|
||||
if (IsLinux() /* || IsOpenbsd() */) {
|
||||
return _futex_wake(addr, n);
|
||||
if (IsLinux() || IsOpenbsd()) {
|
||||
return _futex_wake_public(addr, n);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue