8 Con_Printf(
"Threading disabled in this build\n");
30 Sys_Printf(
"%p mutex create %s:%i\n" , mutex, filename, fileline);
38 Sys_Printf(
"%p mutex destroy %s:%i\n", mutex, filename, fileline);
46 Sys_Printf(
"%p mutex lock %s:%i\n" , mutex, filename, fileline);
48 return (WaitForSingleObject(mutex, INFINITE) == WAIT_FAILED) ? -1 : 0;
54 Sys_Printf(
"%p mutex unlock %s:%i\n" , mutex, filename, fileline);
56 return (ReleaseMutex(mutex) ==
false) ? -1 : 0;
59typedef struct thread_semaphore_s
82 int r = WaitForSingleObject(s->
semaphore, msec);
83 if (
r == WAIT_OBJECT_0)
85 InterlockedDecrement(&s->
value);
88 if (
r == WAIT_TIMEOUT)
95 InterlockedIncrement(&s->
value);
98 InterlockedDecrement(&s->
value);
102typedef struct thread_cond_s
121 Sys_Printf(
"%p cond create %s:%i\n" , c, filename, fileline);
130 Sys_Printf(
"%p cond destroy %s:%i\n" , cond, filename, fileline);
134 CloseHandle(c->
mutex);
142 Sys_Printf(
"%p cond signal %s:%i\n" , cond, filename, fileline);
144 WaitForSingleObject(c->
mutex, INFINITE);
151 ReleaseMutex(c->
mutex);
163 Sys_Printf(
"%p cond broadcast %s:%i\n" , cond, filename, fileline);
165 WaitForSingleObject(c->
mutex, INFINITE);
170 for (
i = 0;
i <
n;
i++)
173 ReleaseMutex(c->
mutex);
174 for (
i = 0;
i <
n;
i++)
184 Sys_Printf(
"%p cond wait %s:%i\n" , cond, filename, fileline);
187 WaitForSingleObject(c->
mutex, INFINITE);
189 ReleaseMutex(c->
mutex);
194 WaitForSingleObject(c->
mutex, INFINITE);
203 ReleaseMutex(c->
mutex);
205 WaitForSingleObject(mutex, INFINITE);
209typedef struct threadwrapper_s
223 _endthreadex(
w->result);
231 Sys_Printf(
"%p thread create %s:%i\n" ,
w, filename, fileline);
245 Sys_Printf(
"%p thread wait %s:%i\n" ,
w, filename, fileline);
247 WaitForSingleObject(
w->handle, INFINITE);
248 CloseHandle(
w->handle);
280 Sys_Printf(
"%p barrier destroy %s:%i\n",
b, filename, fileline);
290 Sys_Printf(
"%p barrier wait %s:%i\n",
b, filename, fileline);
294 if (
b->called ==
b->needed) {
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLubyte GLubyte GLubyte GLubyte w
GLenum GLenum GLsizei count
GLsizeiptr const GLvoid * data
thread_semaphore_t * done
void Sys_Printf(const char *fmt,...)
used to report failures inside Con_Printf()
#define Thread_CondBroadcast(cond)
#define Thread_DestroyMutex(m)
#define Thread_DestroyCond(cond)
#define Thread_CreateMutex()
#define Thread_LockMutex(m)
#define Thread_CreateCond()
#define Thread_UnlockMutex(m)
#define Thread_CondWait(cond, mutex)
int _Thread_WaitThread(void *d, int retval, const char *filename, int fileline)
void * _Thread_CreateBarrier(unsigned int count, const char *filename, int fileline)
int _Thread_CondWait(void *cond, void *mutex, const char *filename, int fileline)
void * _Thread_CreateMutex(const char *filename, int fileline)
void _Thread_WaitBarrier(void *barrier, const char *filename, int fileline)
int _Thread_UnlockMutex(void *mutex, const char *filename, int fileline)
qbool Thread_HasThreads(void)
void * _Thread_CreateThread(int(*fn)(void *), void *data, const char *filename, int fileline)
int _Thread_LockMutex(void *mutex, const char *filename, int fileline)
void * _Thread_CreateCond(const char *filename, int fileline)
int _Thread_CondSignal(void *cond, const char *filename, int fileline)
void _Thread_DestroyCond(void *cond, const char *filename, int fileline)
void Thread_Shutdown(void)
unsigned int __stdcall Thread_WrapperFunc(void *d)
static int Thread_WaitSemaphore(thread_semaphore_t *s, unsigned int msec)
void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline)
static int Thread_PostSemaphore(thread_semaphore_t *s)
static void Thread_DestroySemaphore(thread_semaphore_t *s)
static thread_semaphore_t * Thread_CreateSemaphore(unsigned int v)
void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline)
int _Thread_CondBroadcast(void *cond, const char *filename, int fileline)