Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/redis_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <signal.h>
#include <iostream>

bool should_exit = false;
volatile std::atomic_bool should_exit(false);
cpp_redis::redis_client client;

void
Expand Down
3 changes: 2 additions & 1 deletion includes/cpp_redis/network/io_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace network {
class io_service {
public:
//! ctor & dtor
io_service(void) = default;
io_service(void);
~io_service(void);

//! copy ctor & assignment operator
Expand All @@ -28,6 +28,7 @@ class io_service {

private:
boost::asio::io_service m_io_service;
boost::asio::io_service::work m_work;
std::thread m_io_service_thread;
};

Expand Down
7 changes: 6 additions & 1 deletion sources/network/io_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ namespace cpp_redis {

namespace network {

io_service::io_service(void)
: m_work(m_io_service) {}

io_service::~io_service(void) {
if (m_io_service_thread.joinable())
if (m_io_service_thread.joinable()) {
m_io_service.stop();
m_io_service_thread.join();
}
}

void
Expand Down