diff --git a/Server/src/Chattering.log b/Server/src/Chattering.log new file mode 100644 index 0000000..848a256 --- /dev/null +++ b/Server/src/Chattering.log @@ -0,0 +1,12 @@ +[2025-04-24 21:34:04.752] [Chattering Logger] [info] thread? +[2025-04-24 21:34:04.752] [Chattering Logger] [info] Waiting for connection... +[2025-04-24 21:34:24.926] [Chattering Logger] [info] thread? +[2025-04-24 21:34:24.926] [Chattering Logger] [info] Waiting for connection... +[2025-04-24 21:34:39.658] [Chattering Logger] [info] thread? +[2025-04-24 21:34:39.658] [Chattering Logger] [info] Waiting for connection... +[2025-04-24 21:34:48.422] [Chattering Logger] [info] Waiting for connection... +[2025-04-24 21:34:48.422] [Chattering Logger] [info] thread? +[2025-04-24 21:34:49.422] [Chattering Logger] [info] thread? +[2025-04-24 21:35:32.526] [Chattering Logger] [info] thread? +[2025-04-24 21:35:33.526] [Chattering Logger] [info] thread? +[2025-04-24 21:35:33.526] [Chattering Logger] [info] Waiting for connection... diff --git a/include/Utils/config.json b/Server/src/config.json similarity index 100% rename from include/Utils/config.json rename to Server/src/config.json diff --git a/Server/src/server.cpp b/Server/src/server.cpp index c8ef60b..9597daa 100644 --- a/Server/src/server.cpp +++ b/Server/src/server.cpp @@ -41,6 +41,8 @@ int main() { Chattr::Thread t1([]() { spdlog::info("thread?"); + sleep(1); + spdlog::info("thread?"); }); spdlog::info("Waiting for connection..."); diff --git a/impl/Utils/Thread.cpp b/impl/Utils/Thread.cpp index 207a74b..c2edc67 100644 --- a/impl/Utils/Thread.cpp +++ b/impl/Utils/Thread.cpp @@ -2,7 +2,8 @@ namespace Chattr { Thread::~Thread() { - join(); + if (!detached) + join(); } void Thread::join() { @@ -12,4 +13,11 @@ void Thread::join() { pthread_join(handle_, NULL); #endif } -} \ No newline at end of file + +void Thread::deatch() { + detached = true; +} + +} + + diff --git a/include/Utils/Chattering.log b/include/Utils/Chattering.log deleted file mode 100644 index e69de29..0000000 diff --git a/include/Utils/Thread.hpp b/include/Utils/Thread.hpp index 4e7ba26..da1b5b9 100644 --- a/include/Utils/Thread.hpp +++ b/include/Utils/Thread.hpp @@ -41,6 +41,7 @@ public: ~Thread(); void join(); + void deatch(); private: #ifdef _WIN32 @@ -48,6 +49,7 @@ private: #elif __linux__ pthread_t handle_; #endif + bool detached = false; }; } // namespace Chattr \ No newline at end of file