mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Add *NSYNC mu_test
This commit is contained in:
parent
b5cb71ab84
commit
9b89a7c51d
13 changed files with 2101 additions and 28 deletions
2054
examples/mu_test.c
Normal file
2054
examples/mu_test.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -159,6 +159,8 @@ static void SetLimit(int resource, uint64_t soft, uint64_t hard) {
|
|||
}
|
||||
}
|
||||
|
||||
#pragma weak main
|
||||
|
||||
/**
|
||||
* Generic test program main function.
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "third_party/nsync/counter.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
#include "third_party/nsync/waiter.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "third_party/nsync/common.internal.h"
|
||||
#include "third_party/nsync/cv.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
#include "third_party/nsync/waiter.h"
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "third_party/nsync/common.internal.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "third_party/nsync/common.internal.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/mu_wait.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
#include "third_party/nsync/waiter.h"
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/once.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "third_party/nsync/common.internal.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
#include "third_party/nsync/waiter.h"
|
||||
|
||||
|
|
1
third_party/nsync/common.c
vendored
1
third_party/nsync/common.c
vendored
|
@ -24,6 +24,7 @@
|
|||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/malloc.internal.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
|
|
28
third_party/nsync/common.internal.h
vendored
28
third_party/nsync/common.internal.h
vendored
|
@ -12,34 +12,6 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Annotations for race detectors. */
|
||||
#if defined(__has_feature) && !defined(__SANITIZE_THREAD__)
|
||||
#if __has_feature(thread_sanitizer) /* used by clang */
|
||||
#define __SANITIZE_THREAD__ 1 /* GCC uses this; fake it in clang */
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__SANITIZE_THREAD__)
|
||||
NSYNC_C_START_
|
||||
void AnnotateIgnoreWritesBegin(const char *file, int line);
|
||||
void AnnotateIgnoreWritesEnd(const char *file, int line);
|
||||
void AnnotateIgnoreReadsBegin(const char *file, int line);
|
||||
void AnnotateIgnoreReadsEnd(const char *file, int line);
|
||||
NSYNC_C_END_
|
||||
#define IGNORE_RACES_START() \
|
||||
do { \
|
||||
AnnotateIgnoreReadsBegin(__FILE__, __LINE__); \
|
||||
AnnotateIgnoreWritesBegin(__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
#define IGNORE_RACES_END() \
|
||||
do { \
|
||||
AnnotateIgnoreWritesEnd(__FILE__, __LINE__); \
|
||||
AnnotateIgnoreReadsEnd(__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define IGNORE_RACES_START()
|
||||
#define IGNORE_RACES_END()
|
||||
#endif
|
||||
|
||||
#ifndef NSYNC_DEBUG
|
||||
#define NSYNC_DEBUG 0
|
||||
#endif
|
||||
|
|
1
third_party/nsync/mu.c
vendored
1
third_party/nsync/mu.c
vendored
|
@ -20,6 +20,7 @@
|
|||
#include "third_party/nsync/common.internal.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/races.internal.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
|
|
36
third_party/nsync/races.internal.h
vendored
Normal file
36
third_party/nsync/races.internal.h
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Annotations for race detectors. */
|
||||
#if defined(__has_feature) && !defined(__SANITIZE_THREAD__)
|
||||
#if __has_feature(thread_sanitizer) /* used by clang */
|
||||
#define __SANITIZE_THREAD__ 1 /* GCC uses this; fake it in clang */
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__SANITIZE_THREAD__)
|
||||
NSYNC_C_START_
|
||||
void AnnotateIgnoreWritesBegin(const char *file, int line);
|
||||
void AnnotateIgnoreWritesEnd(const char *file, int line);
|
||||
void AnnotateIgnoreReadsBegin(const char *file, int line);
|
||||
void AnnotateIgnoreReadsEnd(const char *file, int line);
|
||||
NSYNC_C_END_
|
||||
#define IGNORE_RACES_START() \
|
||||
do { \
|
||||
AnnotateIgnoreReadsBegin(__FILE__, __LINE__); \
|
||||
AnnotateIgnoreWritesBegin(__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
#define IGNORE_RACES_END() \
|
||||
do { \
|
||||
AnnotateIgnoreWritesEnd(__FILE__, __LINE__); \
|
||||
AnnotateIgnoreReadsEnd(__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define IGNORE_RACES_START()
|
||||
#define IGNORE_RACES_END()
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_ */
|
Loading…
Reference in a new issue