KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
barrier.c File Reference
#include <kos/thread.h>
#include <kos/barrier.h>
#include <dc/wdt.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdatomic.h>
#include <stdio.h>

Macros

#define WATCHDOG_TIMEOUT   (10 * 1000 * 1000) /* 10s */
 
#define THREAD_COUNT   15 /* Number of threads to spawn */
 
#define BARRIER_COUNT   5 /* Number of barriers within pipeline */
 
#define ITERATION_COUNT   10 /* Number of times to run through pipeline */
 

Functions

static bool run_iteration (uintptr_t tid)
 
static void * thread_exec (void *user_data)
 
static void watchdog_timeout (void *user_data)
 
int main (int argc, char *argv[])
 

Variables

struct { 
 
   thd_barrier_t   barrier 
 
   atomic_uint   pre_barrier_counter 
 
   atomic_uint   serial_barrier_counter 
 
   atomic_uint   post_barrier_counter 
 
data [BARRIER_COUNT] = { 0 } 
 

Macro Definition Documentation

◆ BARRIER_COUNT

#define BARRIER_COUNT   5 /* Number of barriers within pipeline */

Referenced by main(), and run_iteration().

◆ ITERATION_COUNT

#define ITERATION_COUNT   10 /* Number of times to run through pipeline */

Referenced by main(), and thread_exec().

◆ THREAD_COUNT

#define THREAD_COUNT   15 /* Number of threads to spawn */

Referenced by main().

◆ WATCHDOG_TIMEOUT

#define WATCHDOG_TIMEOUT   (10 * 1000 * 1000) /* 10s */

Referenced by main().

Function Documentation

◆ main()

◆ run_iteration()

static bool run_iteration ( uintptr_t tid)
static

◆ thread_exec()

static void * thread_exec ( void * user_data)
static

References ITERATION_COUNT, and run_iteration().

Referenced by main().

◆ watchdog_timeout()

static void watchdog_timeout ( void * user_data)
static

References fprintf.

Referenced by main().

Variable Documentation

◆ barrier

thd_barrier_t barrier

Referenced by main(), and run_iteration().

◆ [struct]

◆ post_barrier_counter

atomic_uint post_barrier_counter

Referenced by main().

◆ pre_barrier_counter

atomic_uint pre_barrier_counter

Referenced by main().

◆ serial_barrier_counter

atomic_uint serial_barrier_counter

Referenced by main().