KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
atomics.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <threads.h>
#include <stdatomic.h>

Macros

#define THREAD_COUNT   20 /* # of threads to spawn */
 
#define ITERATION_COUNT   5 /* # of times to iterate over each atomic */
 
#define BUFFER_SIZE   4096 /* # of bytes in atomic buffer */
 
#define BUFFER_UPDATE_COUNT   100 /* # of times to update atomic buffer */
 

Functions

static _Atomic (uint8_t)
 
static void atomic_add_buffer (unsigned tid, int delta)
 
static int thread (void *arg)
 
int main (int arg, char *argv[])
 

Variables

static atomic_flag flag_atomic = ATOMIC_FLAG_INIT
 
static atomic_bool bool_atomic = false
 
static atomic_int int_atomic = INT_MAX
 
static _Atomic uint64_t longlong_atomic = 0
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   4096 /* # of bytes in atomic buffer */

◆ BUFFER_UPDATE_COUNT

#define BUFFER_UPDATE_COUNT   100 /* # of times to update atomic buffer */

Referenced by thread().

◆ ITERATION_COUNT

#define ITERATION_COUNT   5 /* # of times to iterate over each atomic */

Referenced by main(), and thread().

◆ THREAD_COUNT

#define THREAD_COUNT   20 /* # of threads to spawn */

Referenced by main().

Function Documentation

◆ _Atomic()

static _Atomic ( uint8_t )
static

◆ atomic_add_buffer()

static void atomic_add_buffer ( unsigned tid,
int delta )
static

References printf.

Referenced by thread().

◆ main()

◆ thread()

Variable Documentation

◆ bool_atomic

atomic_bool bool_atomic = false
static

Referenced by main(), and thread().

◆ flag_atomic

atomic_flag flag_atomic = ATOMIC_FLAG_INIT
static

Referenced by main(), and thread().

◆ int_atomic

atomic_int int_atomic = INT_MAX
static

Referenced by main(), and thread().

◆ longlong_atomic

_Atomic uint64_t longlong_atomic = 0
static

Referenced by main(), and thread().