Quake II RTX doxygen  1.0 dev
threads.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  pthread_mutex_t
 
struct  threads_t
 

Macros

#define threads_mutex_lock(m)   ((void*)m)
 
#define threads_mutex_unlock(m)   ((void*)m)
 
#define threads_mutex_destroy(m)   ((void*)m)
 
#define threads_mutex_init(m, p)   ((void*)m)
 
#define __sync_fetch_and_add(p, a)   ((*(p) += (a)), *(p) - (a))
 
#define aligned_alloc(a, s)   _aligned_malloc(s, a)
 
#define aligned_free(p)   _aligned_free(p)
 
#define sysconf(x)   1
 
#define usleep(x)
 
#define sched_yield()
 

Typedefs

typedef struct threads_t threads_t
 

Functions

static void pthread_pool_task_init (uint32_t *task, void *pool, void *(*f)(void *), void *param)
 
static void pthread_pool_wait (void *pool)
 
static threads_tthreads_init (uint32_t num_threads)
 
static void threads_cleanup (threads_t *t)
 

Variables

uint32_t threads_id
 

Macro Definition Documentation

◆ __sync_fetch_and_add

#define __sync_fetch_and_add (   p,
 
)    ((*(p) += (a)), *(p) - (a))

Definition at line 17 of file threads.h.

◆ aligned_alloc

#define aligned_alloc (   a,
 
)    _aligned_malloc(s, a)

Definition at line 20 of file threads.h.

◆ aligned_free

#define aligned_free (   p)    _aligned_free(p)

Definition at line 23 of file threads.h.

◆ sched_yield

#define sched_yield ( )

Definition at line 31 of file threads.h.

◆ sysconf

#define sysconf (   x)    1

Definition at line 26 of file threads.h.

◆ threads_mutex_destroy

#define threads_mutex_destroy (   m)    ((void*)m)

Definition at line 13 of file threads.h.

◆ threads_mutex_init

#define threads_mutex_init (   m,
 
)    ((void*)m)

Definition at line 14 of file threads.h.

◆ threads_mutex_lock

#define threads_mutex_lock (   m)    ((void*)m)

Definition at line 11 of file threads.h.

◆ threads_mutex_unlock

#define threads_mutex_unlock (   m)    ((void*)m)

Definition at line 12 of file threads.h.

◆ usleep

#define usleep (   x)

Definition at line 28 of file threads.h.

Typedef Documentation

◆ threads_t

typedef struct threads_t threads_t

Function Documentation

◆ pthread_pool_task_init()

static void pthread_pool_task_init ( uint32_t *  task,
void pool,
void *(*)(void *)  f,
void param 
)
inlinestatic

Definition at line 43 of file threads.h.

44 { // single threaded execution in line
45  f(param);
46 }

◆ pthread_pool_wait()

static void pthread_pool_wait ( void pool)
inlinestatic

Definition at line 48 of file threads.h.

48 { }

◆ threads_cleanup()

static void threads_cleanup ( threads_t t)
inlinestatic

Definition at line 60 of file threads.h.

61 {
62  free(t);
63 }

◆ threads_init()

static threads_t* threads_init ( uint32_t  num_threads)
inlinestatic

Definition at line 50 of file threads.h.

51 {
52  threads_t *t = malloc(sizeof(*t));
53  t->num_threads = 1;
54  t->task[0] = 0;
55  t->pool = 0;
56  threads_id = 0;
57  return t;
58 }

Variable Documentation

◆ threads_id

uint32_t threads_id

Definition at line 4 of file threads.c.

Referenced by threads_init().

threads_t
Definition: threads.h:34
threads_t::pool
void * pool
Definition: threads.h:38
threads_t::num_threads
uint32_t num_threads
Definition: threads.h:36
threads_id
uint32_t threads_id
Definition: threads.c:4
threads_t::task
uint32_t task[1]
Definition: threads.h:37