threads.c File Reference

#include <SDL_thread.h>
#include "bsp.h"
Include dependency graph for threads.c:

Go to the source code of this file.

Defines

#define MAX_THREADS   8

Functions

static int GetThreadWork (void)
 Return an iteration of work, updating progress when appropriate.
static int ThreadWork (void *p)
 Shared work entry point by all threads. Retrieve and perform chunks of work iteratively until work is finished.
static void ThreadInit (void)
static void ThreadRelease (void)
void ThreadLock (void)
 Lock the shared data by the calling thread.
void ThreadUnlock (void)
 Release the lock on the shared data.
static void RunThreads (void)
void RunThreadsOn (void(*func)(unsigned int), int unsigned workcount, qboolean progress, const char *id)
 Entry point for all thread work requests.
void RunSingleThreadOn (void(*func)(unsigned int), int unsigned workcount, qboolean progress, const char *id)
 Entry point for all thread work requests.

Variables

threadstate_t threadstate
static void(* WorkFunction )(unsigned int)
 Generic function pointer to actual work to be done.
static SDL_mutex * lock = NULL

Define Documentation

#define MAX_THREADS   8

Definition at line 27 of file threads.c.

Referenced by RunThreads(), and RunThreadsOn().


Function Documentation

static int GetThreadWork ( void   )  [static]

Return an iteration of work, updating progress when appropriate.

Definition at line 34 of file threads.c.

References f, ThreadLock(), threadstate, and ThreadUnlock().

Referenced by ThreadWork().

void RunSingleThreadOn ( void(*)(unsigned int)  func,
int unsigned  workcount,
qboolean  progress,
const char *  id 
)

Entry point for all thread work requests.

Definition at line 199 of file threads.c.

References RunThreadsOn(), and threadstate.

static void RunThreads ( void   )  [static]

Definition at line 137 of file threads.c.

References i, MAX_THREADS, ThreadInit(), ThreadRelease(), threadstate, and ThreadWork().

Referenced by RunThreadsOn().

void RunThreadsOn ( void(*)(unsigned int)  func,
int unsigned  workcount,
qboolean  progress,
const char *  id 
)

Entry point for all thread work requests.

Definition at line 162 of file threads.c.

References MAX_THREADS, RunThreads(), threadstate, VERB_NORMAL, Verb_Printf(), and WorkFunction.

static void ThreadInit ( void   )  [static]

Definition at line 92 of file threads.c.

References lock, and Sys_Error().

Referenced by RunThreads().

void ThreadLock ( void   ) 

Lock the shared data by the calling thread.

Definition at line 112 of file threads.c.

References lock, Sys_Error(), and threadstate.

Referenced by FinalLightFace(), and GetThreadWork().

static void ThreadRelease ( void   )  [static]

Definition at line 103 of file threads.c.

References lock.

Referenced by RunThreads().

void ThreadUnlock ( void   ) 

Release the lock on the shared data.

Definition at line 126 of file threads.c.

References lock, Sys_Error(), and threadstate.

Referenced by FinalLightFace(), and GetThreadWork().

static int ThreadWork ( void *  p  )  [static]

Shared work entry point by all threads. Retrieve and perform chunks of work iteratively until work is finished.

Definition at line 77 of file threads.c.

References GetThreadWork(), qtrue, and WorkFunction.

Referenced by RunThreads().


Variable Documentation

SDL_mutex* lock = NULL [static]

Definition at line 90 of file threads.c.

Referenced by ThreadInit(), ThreadLock(), ThreadRelease(), and ThreadUnlock().

void(* WorkFunction)(unsigned int) [static]

Generic function pointer to actual work to be done.

Referenced by RunThreadsOn(), and ThreadWork().


Generated by  doxygen 1.6.2