If the watcher for the log has been deregistered (log closed), set the
release flag to prevent attempts to enable the watcher.
void buffered_log_stream::flush_for_release()
{
+ if (release) return;
+
release = true;
// Try to flush any messages that are currently buffered. (Console is non-blocking
{
if (fd > STDERR_FILENO) {
bp_sys::close(fd);
- fd = -1;
}
+ fd = -1;
+ release = true; // prevent attempt to enable watch
+
// Here we rely on there only being two logs, console and "main"; we can check if we are the
// main log via identity:
if (&log_stream[DLOG_MAIN] == this) {