This repository was archived by the owner on Apr 6, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +44
-13
lines changed Expand file tree Collapse file tree 7 files changed +44
-13
lines changed Original file line number Diff line number Diff line change 2424# compilation options
2525###
2626IF (NOT WIN32 )
27- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread - std=c++11" )
27+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
2828ENDIF (NOT WIN32 )
2929
3030
@@ -60,3 +60,22 @@ target_link_libraries(cpp_redis_kill cpp_redis)
6060
6161add_executable (cpp_redis_high_availability_client cpp_redis_high_availability_client.cpp)
6262target_link_libraries (cpp_redis_high_availability_client cpp_redis)
63+
64+ ###
65+ # link libs
66+ ###
67+ IF (WIN32 )
68+ target_link_libraries (cpp_redis_client ws2_32)
69+ target_link_libraries (cpp_redis_future_client ws2_32)
70+ target_link_libraries (cpp_redis_subscriber ws2_32)
71+ target_link_libraries (cpp_redis_logger ws2_32)
72+ target_link_libraries (cpp_redis_kill ws2_32)
73+ target_link_libraries (cpp_redis_high_availability_client ws2_32)
74+ ELSE ()
75+ target_link_libraries (cpp_redis_client pthread)
76+ target_link_libraries (cpp_redis_future_client pthread)
77+ target_link_libraries (cpp_redis_subscriber pthread)
78+ target_link_libraries (cpp_redis_logger pthread)
79+ target_link_libraries (cpp_redis_kill pthread)
80+ target_link_libraries (cpp_redis_high_availability_client pthread)
81+ ENDIF (WIN32 )
Original file line number Diff line number Diff line change @@ -1091,11 +1091,11 @@ class client {
10911091 // !
10921092 // ! reconnection status
10931093 // !
1094- std::atomic_bool m_reconnecting = ATOMIC_VAR_INIT( false ) ;
1094+ std::atomic_bool m_reconnecting;
10951095 // !
10961096 // ! to force cancel reconnection
10971097 // !
1098- std::atomic_bool m_cancel = ATOMIC_VAR_INIT( false ) ;
1098+ std::atomic_bool m_cancel;
10991099
11001100 // !
11011101 // ! sent commands waiting to be executed
@@ -1120,7 +1120,7 @@ class client {
11201120 // !
11211121 // ! number of callbacks currently being running
11221122 // !
1123- std::atomic<unsigned int > m_callbacks_running = ATOMIC_VAR_INIT( 0 ) ;
1123+ std::atomic<unsigned int > m_callbacks_running;
11241124}; // namespace cpp_redis
11251125
11261126} // namespace cpp_redis
Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ class sentinel {
303303 // !
304304 // ! number of callbacks currently being running
305305 // !
306- std::atomic<unsigned int > m_callbacks_running = ATOMIC_VAR_INIT( 0 ) ;
306+ std::atomic<unsigned int > m_callbacks_running;
307307};
308308
309309}; // namespace cpp_redis
Original file line number Diff line number Diff line change @@ -409,11 +409,11 @@ class subscriber {
409409 // !
410410 // ! reconnection status
411411 // !
412- std::atomic_bool m_reconnecting = ATOMIC_VAR_INIT( false ) ;
412+ std::atomic_bool m_reconnecting;
413413 // !
414414 // ! to force cancel reconnection
415415 // !
416- std::atomic_bool m_cancel = ATOMIC_VAR_INIT( false ) ;
416+ std::atomic_bool m_cancel;
417417
418418 // !
419419 // ! subscribed channels and their associated channels
Original file line number Diff line number Diff line change 2626namespace cpp_redis {
2727
2828#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT
29- client::client (void ) {
29+ client::client (void )
30+ : m_reconnecting(false )
31+ , m_cancel(false )
32+ , m_callbacks_running(0 ) {
3033 __CPP_REDIS_LOG (debug, " cpp_redis::client created" );
3134}
3235#endif /* __CPP_REDIS_USE_CUSTOM_TCP_CLIENT */
3336
3437client::client (const std::shared_ptr<network::tcp_client_iface>& tcp_client)
35- : m_client(tcp_client) {
38+ : m_client(tcp_client)
39+ , m_reconnecting(false )
40+ , m_cancel(false )
41+ , m_callbacks_running(0 ) {
3642 __CPP_REDIS_LOG (debug, " cpp_redis::client created" );
3743}
3844
Original file line number Diff line number Diff line change 2929namespace cpp_redis {
3030
3131#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT
32- sentinel::sentinel (void ) {
32+ sentinel::sentinel (void )
33+ : m_callbacks_running(0 ) {
3334 __CPP_REDIS_LOG (debug, " cpp_redis::sentinel created" );
3435}
3536#endif /* __CPP_REDIS_USE_CUSTOM_TCP_CLIENT */
3637
3738sentinel::sentinel (const std::shared_ptr<network::tcp_client_iface>& tcp_client)
38- : m_client(tcp_client) {
39+ : m_client(tcp_client)
40+ , m_callbacks_running(0 ) {
3941 __CPP_REDIS_LOG (debug, " cpp_redis::sentinel created" );
4042}
4143
Original file line number Diff line number Diff line change @@ -28,14 +28,18 @@ namespace cpp_redis {
2828
2929#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT
3030subscriber::subscriber (void )
31- : m_auth_reply_callback(nullptr ) {
31+ : m_auth_reply_callback(nullptr )
32+ , m_reconnecting(false )
33+ , m_cancel(false ) {
3234 __CPP_REDIS_LOG (debug, " cpp_redis::subscriber created" );
3335}
3436#endif /* __CPP_REDIS_USE_CUSTOM_TCP_CLIENT */
3537
3638subscriber::subscriber (const std::shared_ptr<network::tcp_client_iface>& tcp_client)
3739: m_client(tcp_client)
38- , m_auth_reply_callback(nullptr ) {
40+ , m_auth_reply_callback(nullptr )
41+ , m_reconnecting(false )
42+ , m_cancel(false ) {
3943 __CPP_REDIS_LOG (debug, " cpp_redis::subscriber created" );
4044}
4145
You can’t perform that action at this time.
0 commit comments