1 # To the extent possible under law, Eric Wong has waived all copyright and
2 # related or neighboring rights to this examples
4 # Multi-Processing-safe monkey patch for Logger
6 # This monkey patch fixes the case where "preload: true" is used and
7 # the application spawns a background thread upon being loaded.
9 # This removes all lock from the Logger code and solely relies on the
10 # underlying filesystem to handle write(2) system calls atomically when
11 # O_APPEND is used. This is safe in the presence of both multiple
12 # threads (native or green) and multiple processes when writing to
13 # a filesystem with POSIX O_APPEND semantics.
15 # It should be noted that the original locking on Logger could _never_ be
16 # considered reliable on non-POSIX filesystems with multiple processes,
17 # either, so nothing is lost in that case.
20 class Logger::LogDevice
22 @dev.syswrite(message)