28 #include "../../shared/thread.h"
54 fprintf(stdout,
"%i...", f);
93 static SDL_mutex *
lock =
nullptr;
100 lock = SDL_CreateMutex();
105 SDL_DestroyMutex(
lock);
116 }
else if (
lock !=
nullptr && SDL_LockMutex(
lock) != -1) {
130 }
else if (
lock !=
nullptr && SDL_UnlockMutex(
lock) != -1) {
153 SDL_WaitThread(threads[i],
nullptr);
162 void RunThreadsOn (
void (*func)(
unsigned int),
int unsigned workcount,
bool progress,
const char*
id)
180 start = time(
nullptr);
183 fprintf(stdout,
"%10s: ",
id);
199 void RunSingleThreadOn (
void (*func)(
unsigned int),
int unsigned workcount,
bool progress,
const char*
id)
void Sys_Error(const char *error,...)
static int GetThreadWork(void)
Return an iteration of work, updating progress when appropriate.
void ThreadUnlock(void)
Release the lock on the shared data.
static int ThreadWork(void *p)
Shared work entry point by all threads. Retrieve and perform chunks of work iteratively until work is...
void RunThreadsOn(void(*func)(unsigned int), int unsigned workcount, bool progress, const char *id)
Entry point for all thread work requests.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
SDL_Thread * Com_CreateThread(int(*fn)(void *), const char *name, void *data=nullptr)
void ThreadLock(void)
Lock the shared data by the calling thread.
threadstate_t threadstate
void RunSingleThreadOn(void(*func)(unsigned int), int unsigned workcount, bool progress, const char *id)
Entry point for all thread work requests.
static void ThreadRelease(void)
const GLuint *typedef void(APIENTRY *GenRenderbuffersEXT_t)(GLsizei
static void(* WorkFunction)(unsigned int)
Generic function pointer to actual work to be done.
static void ThreadInit(void)
static void RunThreads(void)