정리 중..

This commit is contained in:
2025-08-28 21:34:21 +09:00
parent c59fef1d0b
commit a03ed2dc78
5 changed files with 6 additions and 68 deletions

8
.vscode/tasks.json vendored
View File

@@ -4,8 +4,8 @@
"tasks": [
{
"type": "cppbuild",
"label": "make",
"command": "make",
"label": "ninja",
"command": "ninja",
"args": [],
"options": {
"cwd": "${workspaceFolder}/build/"
@@ -21,7 +21,9 @@
"label": "cmake",
"command": "cmake",
"args": [
".."
"..",
"-G",
"Ninja"
],
"options": {
"cwd": "${workspaceFolder}/build/"

View File

@@ -14,21 +14,15 @@ aux_source_directory("src/Settings" settings)
aux_source_directory("src/Utils" settings)
add_executable(${BOT_NAME} ${coresrc} ${commands} ${settings})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
add_definitions( -DBOOST_ALL_NO_LIB )
set( Boost_USE_STATIC_LIBS ON )
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED)
target_include_directories(${BOT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${OPENSSL_INCLUDE_DIR}
/usr/include/opus
)
@@ -37,10 +31,5 @@ target_link_libraries(${BOT_NAME}
opus
ogg
oggz
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_CRYPTO_LIBRARY}
${OPENSSL_SSL_LIBRARY}
${Boost_LIBRARIES}
)
link_directories(/usr/lib)
)

View File

@@ -1,25 +0,0 @@
#pragma once
#include <memory>
#include <functional>
#include <thread>
#include <condition_variable>
#include <queue>
namespace bumbleBee {
template <typename FuncRet, typename FuncParam>
class ThreadPool {
public:
ThreadPool() = delete;
ThreadPool(std::int32_t threadCount);
std::thread::id execute(std::function<FuncRet(FuncParam)> function);
void gracefullStop(std::thread::id thread);
void gracefullAllStop();
private:
std::mutex mutex_;
std::condition_variable condition_;
std::int32_t threadCount_;
std::vector<std::thread> threadPool_;
std::unordered_map<std::thread, std::bool> terminating_;
};
}

View File

@@ -1,28 +0,0 @@
#include "Utils/ThreadPool.hpp"
namespace bumbleBee {
template <typename FuncRet, typename FuncParam>
ThreadPool<FuncRet, FuncParam>::ThreadPool(std::int32_t threadCount) {
this.threadCount = threadCount;
while (threadCount--) {
threadPool.
}
}
template <typename FuncRet, typename FuncParam>
void ThreadPool<FuncRet, FuncParam>::gracefullAllStop() {
std::unique_lock<std::mutex> lock(mutex_);
for (auto& thread : threadPool_) {
terminating_[thread] = true;
condition_.notify_all();
}
for (auto& thread : threadPool_) {
if (thread.joinable()) {
thread.join();
}
}
threadPool_.clear();
terminating_.clear();
}
}

BIN
yt-dlp

Binary file not shown.