File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 8
8
#endif
9
9
10
10
#include < iostream>
11
- #include < boost/thread/shared_mutex.hpp>
12
- #include < boost/thread/shared_lock_guard.hpp>
11
+ #include < memory>
13
12
#include < network/logging/logging.hpp>
14
13
15
14
namespace network { namespace logging {
@@ -32,23 +31,22 @@ namespace handler
32
31
namespace
33
32
{
34
33
// the log handler have to manage itself the thread safety on call
35
- log_record_handler current_log_record_handler = handler::std_log_handler;
36
- boost::upgrade_mutex mutex_log_handler; // we still need to not change the log handler concurrently
34
+ static auto current_log_record_handler = std::make_shared<log_record_handler>( & handler::std_log_handler ) ;
35
+
37
36
}
38
37
39
38
40
39
void set_log_record_handler ( log_record_handler handler )
41
40
{
42
- boost::lock_guard<boost::upgrade_mutex> write_lock ( mutex_log_handler );
43
- current_log_record_handler = handler;
41
+ current_log_record_handler = std::make_shared<log_record_handler>( handler );
44
42
}
45
43
46
44
void log ( const log_record& log )
47
45
{
48
- boost::shared_lock<boost::upgrade_mutex> read_lock ( mutex_log_handler ) ;
49
- if ( current_log_record_handler )
46
+ auto log_handler = current_log_record_handler ;
47
+ if ( log_handler )
50
48
{
51
- current_log_record_handler ( log );
49
+ (*log_handler) ( log );
52
50
}
53
51
}
54
52
You can’t perform that action at this time.
0 commit comments