54 fprintf(stdout,
"%i...",
f);
93static 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);
162void RunThreadsOn (
void (*func)(
unsigned int),
int unsigned workcount,
bool progress,
const char*
id)
180 start = time(
nullptr);
183 fprintf(stdout,
"%10s: ",
id);
199void RunSingleThreadOn (
void (*func)(
unsigned int),
int unsigned workcount,
bool progress,
const char*
id)
void Sys_Error(const char *error,...)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
QGL_EXTERN void(APIENTRY *qglActiveTexture)(GLenum texture)
SDL_Thread * Com_CreateThread(int(*fn)(void *), const char *name, void *data=nullptr)
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...
static void(* WorkFunction)(unsigned int)
Generic function pointer to actual work to be done.
static void ThreadRelease(void)
void RunThreadsOn(void(*func)(unsigned int), int unsigned workcount, bool progress, const char *id)
Entry point for all thread work requests.
void RunSingleThreadOn(void(*func)(unsigned int), int unsigned workcount, bool progress, const char *id)
Entry point for all thread work requests.
static int GetThreadWork(void)
Return an iteration of work, updating progress when appropriate.
static void ThreadInit(void)
static void RunThreads(void)
void ThreadLock(void)
Lock the shared data by the calling thread.