|
1 | 1 | #include "g_local.h" |
2 | 2 | #include "v_characterio.h" |
| 3 | + |
| 4 | +#include <pthread.h> |
| 5 | + |
| 6 | +// Threading |
| 7 | +static pthread_t QueueThread; |
| 8 | +static pthread_attr_t attr; |
| 9 | +static pthread_mutex_t mutex_gds_queue; |
| 10 | +static pthread_mutex_t MemMutex_Free; |
| 11 | +static pthread_mutex_t MemMutex_Malloc; |
| 12 | +static pthread_mutex_t mutex_gds_thread_status; |
| 13 | + |
3 | 14 | #ifndef NO_GDS |
4 | 15 |
|
5 | 16 | #include <mysql.h> |
6 | 17 | #include "gds.h" |
7 | 18 | #include "characters/class_limits.h" |
8 | 19 |
|
9 | | -#include <pthread.h> |
10 | | - |
11 | 20 | #ifdef _WIN32 |
12 | 21 | #pragma warning ( disable : 4090 ; disable : 4996 ) |
13 | 22 | #endif |
@@ -86,14 +95,6 @@ static gds_queue_t *last = NULL; |
86 | 95 | static cvar_t *gds_singleserver; |
87 | 96 | static cvar_t *gds_serverkey; |
88 | 97 |
|
89 | | -// Threading |
90 | | -static pthread_t QueueThread; |
91 | | -static pthread_attr_t attr; |
92 | | -static pthread_mutex_t mutex_gds_queue; |
93 | | -static pthread_mutex_t MemMutex_Free; |
94 | | -static pthread_mutex_t MemMutex_Malloc; |
95 | | -static pthread_mutex_t mutex_gds_thread_status; |
96 | | - |
97 | 98 | static qboolean ThreadRunning; |
98 | 99 |
|
99 | 100 | // Prototypes |
@@ -1931,11 +1932,6 @@ qboolean gds_connect() { |
1931 | 1932 | return true; |
1932 | 1933 | } |
1933 | 1934 |
|
1934 | | -void Mem_PrepareMutexes() { |
1935 | | - pthread_mutex_init(&MemMutex_Malloc, NULL); |
1936 | | - pthread_mutex_init(&MemMutex_Free, NULL); |
1937 | | -} |
1938 | | - |
1939 | 1935 | qboolean gds_enabled() { |
1940 | 1936 | return GDS_MySQL != NULL; |
1941 | 1937 | } |
@@ -1979,6 +1975,11 @@ void gds_finish_thread() { |
1979 | 1975 |
|
1980 | 1976 | #endif // NO_GDS |
1981 | 1977 |
|
| 1978 | +void Mem_PrepareMutexes() { |
| 1979 | + pthread_mutex_init(&MemMutex_Malloc, NULL); |
| 1980 | + pthread_mutex_init(&MemMutex_Free, NULL); |
| 1981 | +} |
| 1982 | + |
1982 | 1983 | void *vrx_malloc(size_t Size, int Tag) { |
1983 | 1984 | void *Memory; |
1984 | 1985 | pthread_mutex_lock(&MemMutex_Malloc); |
|
0 commit comments