mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 16:52:28 +00:00
Add *NSYNC unit test suite
This change also fixes the clock_nanosleep() api and polyfills futexes on Windows, Mac, and NetBSD using exponential backoff.
This commit is contained in:
parent
3421b9a580
commit
9849b4c7ba
51 changed files with 5505 additions and 1060 deletions
35
third_party/nsync/testing/closure.c
vendored
Normal file
35
third_party/nsync/testing/closure.c
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2016 Google Inc. │
|
||||
│ │
|
||||
│ Licensed under the Apache License, Version 2.0 (the "License"); │
|
||||
│ you may not use this file except in compliance with the License. │
|
||||
│ You may obtain a copy of the License at │
|
||||
│ │
|
||||
│ http://www.apache.org/licenses/LICENSE-2.0 │
|
||||
│ │
|
||||
│ Unless required by applicable law or agreed to in writing, software │
|
||||
│ distributed under the License is distributed on an "AS IS" BASIS, │
|
||||
│ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │
|
||||
│ See the License for the specific language governing permissions and │
|
||||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/nsync/testing/closure.h"
|
||||
// clang-format off
|
||||
|
||||
void nsync_start_thread_ (void (*f) (void *), void *arg);
|
||||
|
||||
/* Run the closure *cl. */
|
||||
void closure_run (closure *cl) {
|
||||
(*cl->f0) (cl);
|
||||
}
|
||||
|
||||
/* Run the closure (closure *), but wrapped to fix the type. */
|
||||
static void closure_run_body (void *v) {
|
||||
closure_run ((closure *)v);
|
||||
}
|
||||
|
||||
void closure_fork (closure *cl) {
|
||||
nsync_start_thread_ (&closure_run_body, cl);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue