KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
once_test.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <kos/thread.h>
#include <kos/once.h>
#include <kos/mutex.h>
#include <kos/init.h>
#include <arch/arch.h>
#include <dc/maple.h>
#include <dc/maple/controller.h>

Macros

#define UNUSED   __attribute__((unused))
 
#define THD_COUNT   (475 * (DBL_MEM? 2 : 1))
 

Functions

static void inner_once_func (void)
 
static void * inner_thd_func (void *param UNUSED)
 
static void once_func (void)
 
static void * thd_func (void *param UNUSED)
 
 KOS_INIT_FLAGS (INIT_DEFAULT|INIT_MALLOCSTATS)
 
int main (int argc, char *argv[])
 

Variables

static kthread_once_t once = KTHREAD_ONCE_INIT
 
static mutex_t lock = MUTEX_INITIALIZER
 
static int counter = 0
 

Macro Definition Documentation

◆ THD_COUNT

#define THD_COUNT   (475 * (DBL_MEM? 2 : 1))

Referenced by main().

◆ UNUSED

#define UNUSED   __attribute__((unused))

Function Documentation

◆ inner_once_func()

static void inner_once_func ( void )
static

References counter, lock, mutex_lock(), and mutex_unlock().

Referenced by inner_thd_func().

◆ inner_thd_func()

static void * inner_thd_func ( void *param UNUSED)
static

◆ KOS_INIT_FLAGS()

KOS_INIT_FLAGS ( INIT_DEFAULT| INIT_MALLOCSTATS)

◆ main()

int main ( int argc,
char * argv[] )

◆ once_func()

static void once_func ( void )
static

◆ thd_func()

static void * thd_func ( void *param UNUSED)
static

Variable Documentation

◆ counter

◆ lock

◆ once

Referenced by thd_func().