자잘한 버그픽스 + openssl 디펜던시 추가

This commit is contained in:
2025-04-30 15:34:43 +09:00
parent cf8166f41c
commit 748e69cc2f
6 changed files with 12 additions and 9 deletions

View File

@@ -5,6 +5,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(${PROJECT_NAME} CXX)
find_package(OpenSSL REQUIRED)
include(FetchContent)
FetchContent_Declare(
@@ -42,6 +44,7 @@ add_executable(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PRIVATE Microsoft.GSL::GSL)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_lib)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32)

View File

@@ -5,6 +5,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(${PROJECT_NAME} CXX)
find_package(OpenSSL REQUIRED)
include(FetchContent)
FetchContent_Declare(
@@ -43,6 +45,7 @@ add_executable(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PRIVATE Microsoft.GSL::GSL)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_static)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32)

View File

@@ -60,11 +60,6 @@ int main() {
sock.accept(clientSock, clientAddr);
threadPool.enqueueJob(_TCPClient, std::move(clientSock), clientAddr);
Chattr::Thread thread_(_TCPClient, std::move(clientSock), clientAddr);
thread_.detach();
Sleep(10000000);
}
}

View File

@@ -20,9 +20,9 @@ ThreadPool::~ThreadPool() {
void* ThreadPool::Worker() {
#ifdef _WIN32
DWORD pid = GetCurrentProcessId();
DWORD pid = GetCurrentThreadId();
#elif __linux__
pid_t pid = getpid();
pthread_t pid = pthread_self();
#endif
while (!terminate_) {
std::unique_lock<std::mutex> lock(jobQueueMutex);

View File

@@ -69,7 +69,7 @@ public:
#ifdef _WIN32
WaitForSingleObject(handle_, INFINITE);
#elif __linux__
pthread_join(handle_, returnValue);
pthread_join(handle_, &returnValuePtr);
#endif
}
template<typename _RetType>
@@ -78,7 +78,7 @@ public:
#ifdef _WIN32
WaitForSingleObject(handle_, INFINITE);
#elif __linux__
pthread_join(handle_, returnValue);
pthread_join(handle_, &returnValuePtr);
#endif
return *static_cast<_RetType *>(returnValuePtr);
}

View File

@@ -45,6 +45,8 @@ public:
auto task = std::packaged_task<void()>(std::move(boundFunc));
jobs_.push(std::move(task));
jobQueueCV_.notify_one();
return 0;
}
private: