mirror of https://github.com/flysand7/ciabatta.git
stdatomic.h
This commit is contained in:
parent
8f739d3a10
commit
fa1f9ec0e6
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#if defined(__has_include_next)
|
||||||
|
#if __has_include_next(<stdatomic.h>)
|
||||||
|
#include_next <stdatomic.h>
|
||||||
|
#else
|
||||||
|
#define __STDC_NO_ATOMICS__
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -4,6 +4,7 @@
|
||||||
#include <cia/def.h>
|
#include <cia/def.h>
|
||||||
|
|
||||||
typedef u64 size_t;
|
typedef u64 size_t;
|
||||||
|
typedef i64 ptrdiff_t;
|
||||||
|
|
||||||
#if !defined(NULL)
|
#if !defined(NULL)
|
||||||
#define NULL ((void *)0)
|
#define NULL ((void *)0)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef u32 wchar_t;
|
|
@ -51,7 +51,7 @@ time is discouraged.
|
||||||
| <signal.h> | Signal handling. | none |
|
| <signal.h> | Signal handling. | none |
|
||||||
| <stdalign.h> | Alignment. | none |
|
| <stdalign.h> | Alignment. | none |
|
||||||
| <stdarg.h> | Variable arguments. | none |
|
| <stdarg.h> | Variable arguments. | none |
|
||||||
| <stdatomic.h> | Atomics. | none |
|
| <stdatomic.h> | Atomics. | [1] |
|
||||||
| <stdbit.h> | Bit and byte utilities | none |
|
| <stdbit.h> | Bit and byte utilities | none |
|
||||||
| <stdbool.h> | Boolean type and values. | none |
|
| <stdbool.h> | Boolean type and values. | none |
|
||||||
| <stddef.h> | Common definitions. | none |
|
| <stddef.h> | Common definitions. | none |
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <threads.h>
|
#include <threads.h>
|
||||||
|
#include <stdatomic.h>
|
||||||
|
|
||||||
static void print_string_n(char *str, u64 len) {
|
static void print_string_n(char *str, u64 len) {
|
||||||
fwrite(str, 1, len, stdout);
|
fwrite(str, 1, len, stdout);
|
||||||
|
@ -32,7 +33,7 @@ static void print_int(i64 number) {
|
||||||
print_string(p);
|
print_string(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile i64 counter = 0;
|
volatile _Atomic i64 counter = 0;
|
||||||
|
|
||||||
int thrd_func(void *arg) {
|
int thrd_func(void *arg) {
|
||||||
print_string("child thread: ok!\n");
|
print_string("child thread: ok!\n");
|
||||||
|
|
Loading…
Reference in New Issue