Skip to content

Commit

Permalink
remove jthread, c++20 only
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Nov 16, 2024
1 parent 9c2e71d commit d286958
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <string>
#include <map>
#include <variant>
#include <thread>
#include <dpp/snowflake.h>
#include <dpp/dispatcher.h>
#include <dpp/misc-enum.h>
Expand Down Expand Up @@ -182,7 +183,7 @@ class DPP_EXPORT cluster {
* @brief Used to spawn the socket engine into its own thread if
* the cluster is started with dpp::st_return. It is unused otherwise.
*/
std::unique_ptr<std::jthread> engine_thread{nullptr};
std::unique_ptr<std::thread> engine_thread{nullptr};

public:
/**
Expand Down
4 changes: 2 additions & 2 deletions src/dpp/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ void cluster::start(bool return_after) {
});

if (return_after) {
engine_thread = std::make_unique<std::jthread>(std::jthread([event_loop]() {
engine_thread = std::make_unique<std::thread>([event_loop]() {
dpp::utility::set_thread_name("event_loop");
event_loop();
}));
});
} else {
event_loop();
}
Expand Down

0 comments on commit d286958

Please sign in to comment.