Skip to content

Commit 5d08e85

Browse files
committed
Merge branch 'master' into amir/capi
2 parents 8be5f2d + 12df449 commit 5d08e85

36 files changed

+8086
-24
lines changed

Server/Components/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ add_subdirectory(TextLabels)
2121
add_subdirectory(Timers)
2222
add_subdirectory(Variables)
2323
add_subdirectory(Vehicles)
24+
add_subdirectory(NPCs)
2425

2526
# Pawn
2627
if(BUILD_PAWN_COMPONENT)

Server/Components/Console/console_impl.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class ConsoleComponent final : public IConsoleComponent, public CoreEventHandler
6565
String cmd;
6666
ThreadProcData* threadData;
6767
std::thread cinThread;
68+
std::thread::native_handle_type nativeThreadHandle;
6869

6970
struct PlayerRconCommandHandler : public SingleNetworkInEventHandler
7071
{
@@ -212,7 +213,11 @@ class ConsoleComponent final : public IConsoleComponent, public CoreEventHandler
212213

213214
threadData = new ThreadProcData { true, this };
214215
cinThread = std::thread(ThreadProc, threadData);
216+
nativeThreadHandle = cinThread.native_handle();
217+
218+
#ifndef WIN32
215219
cinThread.detach();
220+
#endif
216221
}
217222

218223
void onReady() override
@@ -257,10 +262,16 @@ class ConsoleComponent final : public IConsoleComponent, public CoreEventHandler
257262
if (threadData)
258263
{
259264
threadData->valid = false;
265+
266+
#ifdef WIN32
260267
if (cinThread.joinable())
261268
{
262269
cinThread.join();
263270
}
271+
#else
272+
pthread_cancel(nativeThreadHandle);
273+
#endif
274+
264275
delete threadData;
265276
threadData = nullptr;
266277
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
2+
include_directories(${CMAKE_SOURCE_DIR}/lib/cpp-httplib)
3+
add_server_component(${ProjectId})
4+
5+
target_link_libraries(${ProjectId} PRIVATE
6+
CONAN_PKG::ghc-filesystem
7+
)

0 commit comments

Comments
 (0)