mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Simplify the pthreads detection macros.
This commit is contained in:
parent
1c20a49dba
commit
ffb6d628bd
2 changed files with 17 additions and 5 deletions
|
@ -34,10 +34,22 @@
|
|||
#endif
|
||||
|
||||
#if defined (HAVE_PTHREAD_H) && defined (HAVE_PTHREAD)
|
||||
#define USE_PTHREADS
|
||||
#endif
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
#include <pthread.h>
|
||||
extern pthread_mutex_t *my_mutex;
|
||||
#define LOCK do {if (options.threads > 1) pthread_mutex_lock (my_mutex); } while (0)
|
||||
#define UNLOCK do {if (options.threads > 1) pthread_mutex_unlock (my_mutex); } while (0)
|
||||
#define LOCK \
|
||||
do { \
|
||||
if (options.threads > 1) \
|
||||
pthread_mutex_lock (my_mutex); \
|
||||
} while (0)
|
||||
#define UNLOCK \
|
||||
do { \
|
||||
if (options.threads > 1) \
|
||||
pthread_mutex_unlock (my_mutex); \
|
||||
} while (0)
|
||||
#else
|
||||
#define LOCK
|
||||
#define UNLOCK
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
#define MAX_THREADS 4
|
||||
|
||||
#if defined (HAVE_PTHREAD_H) && defined (HAVE_PTHREAD)
|
||||
#ifdef USE_PTHREADS
|
||||
pthread_mutex_t *my_mutex;
|
||||
#endif
|
||||
|
||||
|
@ -390,7 +390,7 @@ LeafThread (void *_thread)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if defined (HAVE_PTHREAD_H) && defined (HAVE_PTHREAD)
|
||||
#ifdef USE_PTHREADS
|
||||
static void *
|
||||
WatchThread (void *_thread)
|
||||
{
|
||||
|
@ -536,7 +536,7 @@ CalcPortalVis (void)
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined (HAVE_PTHREAD_H) && defined (HAVE_PTHREAD)
|
||||
#ifdef USE_PTHREADS
|
||||
{
|
||||
pthread_t work_threads[MAX_THREADS + 1];
|
||||
void *status;
|
||||
|
|
Loading…
Reference in a new issue