Skip to content

Commit 084c63d

Browse files
committed
trying to make that build work
1 parent 170b20d commit 084c63d

6 files changed

Lines changed: 28 additions & 31 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,12 @@ endif ()
7272

7373
if (WIN32)
7474
set(CC_LINK_LIBS ${CC_LINK_LIBS} Wininet Winmm)
75-
endif ()
76-
77-
if (UNIX AND VRX_USE_MULTITHREAD)
78-
find_package(Threads)
79-
set(CC_LINK_LIBS ${CC_LINK_LIBS} ${CMAKE_THREAD_LIBS_INIT})
80-
endif ()
8175

82-
if (WIN32 AND VRX_USE_MULTITHREAD)
8376
if (MSVC)
8477
FetchContent_Declare(
85-
pthreads
86-
GIT_REPOSITORY https://github.com/GerHobbelt/pthread-win32
87-
GIT_TAG master
78+
pthreads
79+
GIT_REPOSITORY https://github.com/GerHobbelt/pthread-win32
80+
GIT_TAG master
8881
)
8982

9083
FetchContent_MakeAvailable(pthreads)
@@ -96,6 +89,11 @@ if (WIN32 AND VRX_USE_MULTITHREAD)
9689
endif ()
9790
endif ()
9891

92+
if (UNIX)
93+
find_package(Threads)
94+
set(CC_LINK_LIBS ${CC_LINK_LIBS} ${CMAKE_THREAD_LIBS_INIT})
95+
endif ()
96+
9997
if (VRX_REMOVERESPAWNS)
10098
add_definitions(-DREMOVE_RESPAWNS)
10199
endif ()

src/characters/io/gds.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ qboolean gds_enabled();
3838
void gds_finish_thread();
3939
void gds_handle_status(edict_t *player);
4040

41-
void Mem_PrepareMutexes();
42-
4341
qboolean vrx_mysql_isloading(edict_t *ent);
4442
qboolean vrx_mysql_saveclose_character(edict_t* player);
4543

4644
#endif //NO_GDS
4745

48-
46+
void Mem_PrepareMutexes();
4947

5048
#endif // MYSQL_GDS

src/characters/io/v_mysql_gds.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
#include "g_local.h"
22
#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+
314
#ifndef NO_GDS
415

516
#include <mysql.h>
617
#include "gds.h"
718
#include "characters/class_limits.h"
819

9-
#include <pthread.h>
10-
1120
#ifdef _WIN32
1221
#pragma warning ( disable : 4090 ; disable : 4996 )
1322
#endif
@@ -86,14 +95,6 @@ static gds_queue_t *last = NULL;
8695
static cvar_t *gds_singleserver;
8796
static cvar_t *gds_serverkey;
8897

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-
9798
static qboolean ThreadRunning;
9899

99100
// Prototypes
@@ -1931,11 +1932,6 @@ qboolean gds_connect() {
19311932
return true;
19321933
}
19331934

1934-
void Mem_PrepareMutexes() {
1935-
pthread_mutex_init(&MemMutex_Malloc, NULL);
1936-
pthread_mutex_init(&MemMutex_Free, NULL);
1937-
}
1938-
19391935
qboolean gds_enabled() {
19401936
return GDS_MySQL != NULL;
19411937
}
@@ -1979,6 +1975,11 @@ void gds_finish_thread() {
19791975

19801976
#endif // NO_GDS
19811977

1978+
void Mem_PrepareMutexes() {
1979+
pthread_mutex_init(&MemMutex_Malloc, NULL);
1980+
pthread_mutex_init(&MemMutex_Free, NULL);
1981+
}
1982+
19821983
void *vrx_malloc(size_t Size, int Tag) {
19831984
void *Memory;
19841985
pthread_mutex_lock(&MemMutex_Malloc);

src/menus/menu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define MENU_MULTI_UPGRADE 3
1717
#define MENU_COMBAT_PREFERENCES 4
1818

19-
void menu_add_line (edict_t *ent,char *line,int option);
19+
void menu_add_line (edict_t *ent, const char *line,int option);
2020
void menu_clear (edict_t *ent);
2121
void menu_set_handler (edict_t *ent,void (*optionselected)(edict_t *ent,int option));
2222
void menu_set_close_handler(edict_t* ent, void (*onclose)(edict_t* ent));

src/q_shared.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <string.h>
2727
#include <stdlib.h>
2828
#include <time.h>
29-
29+
#include <limits.h>
3030
#endif
3131
//K03 End
3232

src/server/defer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void defer_global_init()
1515
pthread_mutexattr_t attr;
1616
pthread_mutexattr_init(&attr);
1717

18-
pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
18+
pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_RECURSIVE);
1919

2020
pthread_mutex_init(&defer_mutex, &attr);
2121

0 commit comments

Comments
 (0)