Skip to content
Snippets Groups Projects
Commit df559f30 authored by Beat Küng's avatar Beat Küng Committed by Lorenz Meier
Browse files

logger: unlock the mutex for fsync & call fsync only when backend is running

- fsync can be a long blocking operation, so we need to make sure the main
  logger thread does not block during this time, when it tries to aquire
  the mutex
- fixes calling fsync on an invalid file descriptor
parent 7caf9803
No related branches found
No related tags found
No related merge requests found
......@@ -257,8 +257,10 @@ void LogWriterFile::run()
buffer.close_file();
}
} else if (call_fsync) {
} else if (call_fsync && buffer._should_run) {
pthread_mutex_unlock(&_mtx);
buffer.fsync();
pthread_mutex_lock(&_mtx);
} else if (available == 0 && !buffer._should_run) {
buffer.close_file();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment