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

Macros

#define THREAD_COUNT   100
 
#define UNUSED   __attribute__((unused))
 

Functions

static void destructor (void *data)
 
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 kthread_key_t key1
 
static kthread_key_t key2
 
static atomic_uint dtor_counter
 

Macro Definition Documentation

◆ THREAD_COUNT

#define THREAD_COUNT   100

Referenced by main().

◆ UNUSED

#define UNUSED   __attribute__((unused))

Function Documentation

◆ destructor()

static void destructor ( void * data)
static

References data, dtor_counter, and printf.

Referenced by once_func().

◆ KOS_INIT_FLAGS()

KOS_INIT_FLAGS ( INIT_DEFAULT| INIT_MALLOCSTATS)

◆ main()

◆ once_func()

static void once_func ( void )
static

References destructor(), fprintf, key2, and kthread_key_create().

Referenced by thd_func().

◆ thd_func()

static void * thd_func ( void *param UNUSED)
static

Variable Documentation

◆ dtor_counter

atomic_uint dtor_counter
static

Referenced by destructor(), and main().

◆ key1

kthread_key_t key1
static

Referenced by main(), and thd_func().

◆ key2

kthread_key_t key2
static

Referenced by main(), once_func(), and thd_func().

◆ once

Referenced by thd_func().