This repository was archived by the owner on Apr 6, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
includes/cpp_redis/network Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 33#include < signal.h>
44#include < iostream>
55
6- bool should_exit = false ;
6+ volatile std::atomic_bool should_exit ( false ) ;
77cpp_redis::redis_client client;
88
99void
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ namespace network {
1111class io_service {
1212public:
1313 // ! ctor & dtor
14- io_service (void ) = default ;
14+ io_service (void );
1515 ~io_service (void );
1616
1717 // ! copy ctor & assignment operator
@@ -28,6 +28,7 @@ class io_service {
2828
2929private:
3030 boost::asio::io_service m_io_service;
31+ boost::asio::io_service::work m_work;
3132 std::thread m_io_service_thread;
3233};
3334
Original file line number Diff line number Diff line change @@ -4,9 +4,14 @@ namespace cpp_redis {
44
55namespace network {
66
7+ io_service::io_service (void )
8+ : m_work(m_io_service) {}
9+
710io_service::~io_service (void ) {
8- if (m_io_service_thread.joinable ())
11+ if (m_io_service_thread.joinable ()) {
12+ m_io_service.stop ();
913 m_io_service_thread.join ();
14+ }
1015}
1116
1217void
You can’t perform that action at this time.
0 commit comments