Skip to content

Commit 17f6450

Browse files
committedMar 23, 2016
Re-init logger lock after fork.
1 parent 29f702e commit 17f6450

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed
 

‎machine/environment.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ namespace rubinius {
218218
}
219219

220220
void Environment::start_logging(STATE) {
221+
utilities::logger::init();
221222
utilities::logger::logger_level level = utilities::logger::eWarn;
222223

223224
if(!config.system_log_level.value.compare("fatal")) {
@@ -581,10 +582,10 @@ namespace rubinius {
581582
}
582583

583584
void Environment::halt(STATE, int exit_code) {
584-
utilities::thread::Mutex::LockGuard guard(halt_lock_);
585-
586585
utilities::logger::write("exit process: %s %d", shared->pid.c_str(), exit_code);
587586

587+
utilities::thread::Mutex::LockGuard guard(halt_lock_);
588+
588589
state->shared().tool_broker()->shutdown(state);
589590

590591
if(Memory* om = state->memory()) {

‎machine/util/logger.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ namespace rubinius {
2323
static Logger* logger_ = 0;
2424
static logger_level loglevel_ = eWarn;
2525

26+
void init() {
27+
lock_.init();
28+
}
29+
2630
void open(logger_type type, const char* identifier, logger_level level, ...) {
2731
lock_.init();
2832
va_list varargs;

‎machine/util/logger.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace rubinius {
3232
void info(const char* message, ...);
3333
void debug(const char* message, ...);
3434

35+
void init();
3536
void set_label();
3637
void set_loglevel(logger_level level);
3738

‎machine/vm.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ namespace rubinius {
286286
}
287287

288288
void VM::after_fork_child(STATE) {
289+
utilities::logger::init();
289290
utilities::logger::set_label();
290291

291292
thread_nexus_->after_fork_child(state);

0 commit comments

Comments
 (0)
Please sign in to comment.