27 pthread_mutexattr_t attr;
29 pthread_mutex_t *mutexp = (pthread_mutex_t *)
Z_Malloc(
sizeof(pthread_mutex_t));
31 Sys_Printf(
"%p mutex create %s:%i\n" , mutexp, filename, fileline);
34 pthread_mutexattr_init(&attr);
35 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
36 pthread_mutex_init(mutexp, &attr);
37 pthread_mutexattr_destroy(&attr);
39 pthread_mutex_init(mutexp,
NULL);
46 pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
48 Sys_Printf(
"%p mutex destroy %s:%i\n", mutex, filename, fileline);
50 pthread_mutex_destroy(mutexp);
56 pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
58 Sys_Printf(
"%p mutex lock %s:%i\n" , mutex, filename, fileline);
60 return pthread_mutex_lock(mutexp);
65 pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
67 Sys_Printf(
"%p mutex unlock %s:%i\n" , mutex, filename, fileline);
69 return pthread_mutex_unlock(mutexp);
74 pthread_cond_t *condp = (pthread_cond_t *)
Z_Malloc(
sizeof(pthread_cond_t));
75 pthread_cond_init(condp,
NULL);
77 Sys_Printf(
"%p cond create %s:%i\n" , condp, filename, fileline);
84 pthread_cond_t *condp = (pthread_cond_t *) cond;
86 Sys_Printf(
"%p cond destroy %s:%i\n" , cond, filename, fileline);
88 pthread_cond_destroy(condp);
94 pthread_cond_t *condp = (pthread_cond_t *) cond;
96 Sys_Printf(
"%p cond signal %s:%i\n" , cond, filename, fileline);
98 return pthread_cond_signal(condp);
103 pthread_cond_t *condp = (pthread_cond_t *) cond;
105 Sys_Printf(
"%p cond broadcast %s:%i\n" , cond, filename, fileline);
107 return pthread_cond_broadcast(condp);
112 pthread_cond_t *condp = (pthread_cond_t *) cond;
113 pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
115 Sys_Printf(
"%p cond wait %s:%i\n" , cond, filename, fileline);
117 return pthread_cond_wait(condp, mutexp);
122 pthread_t *threadp = (pthread_t *)
Z_Malloc(
sizeof(pthread_t));
124 Sys_Printf(
"%p thread create %s:%i\n" , threadp, filename, fileline);
126 int r = pthread_create(threadp,
NULL, (
void * (*) (
void *)) fn,
data);
137 pthread_t *threadp = (pthread_t *) thread;
138 void *status = (
void *) (intptr_t) retval;
140 Sys_Printf(
"%p thread wait %s:%i\n" , thread, filename, fileline);
142 pthread_join(*threadp, &status);
144 return (
int) (intptr_t) status;
147#ifdef PTHREAD_BARRIER_SERIAL_THREAD
150 pthread_barrier_t *
b = (pthread_barrier_t *)
Z_Malloc(
sizeof(pthread_barrier_t));
160 pthread_barrier_t *
b = (pthread_barrier_t *) barrier;
162 Sys_Printf(
"%p barrier destroy %s:%i\n",
b, filename, fileline);
164 pthread_barrier_destroy(
b);
169 pthread_barrier_t *
b = (pthread_barrier_t *) barrier;
171 Sys_Printf(
"%p barrier wait %s:%i\n",
b, filename, fileline);
173 pthread_barrier_wait(
b);
202 Sys_Printf(
"%p barrier destroy %s:%i\n",
b, filename, fileline);
212 Sys_Printf(
"%p barrier wait %s:%i\n",
b, filename, fileline);
216 if (
b->called ==
b->needed) {
GLenum GLenum GLsizei count
GLsizeiptr const GLvoid * data
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)
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)
int _Thread_WaitThread(void *thread, int retval, 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)
void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline)
void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline)
int _Thread_CondBroadcast(void *cond, const char *filename, int fileline)