1 # frozen_string_literal: false
2 # Multi-Processing-safe monkey patch for Logger
4 # This monkey patch fixes the case where "preload_app true" is used and
5 # the application spawns a background thread upon being loaded.
7 # This removes all lock from the Logger code and solely relies on the
8 # underlying filesystem to handle write(2) system calls atomically when
9 # O_APPEND is used. This is safe in the presence of both multiple
10 # threads (native or green) and multiple processes when writing to
11 # a filesystem with POSIX O_APPEND semantics.
13 # It should be noted that the original locking on Logger could _never_ be
14 # considered reliable on non-POSIX filesystems with multiple processes,
15 # either, so nothing is lost in that case.
18 class Logger::LogDevice
20 @dev.syswrite(message)