workaround reopen atomicity issues for stdio vs non-stdio
authorEric Wong <e@80x24.org>
Sun, 20 Oct 2013 04:29:55 +0000 (04:29 +0000)
committerEric Wong <normalperson@yhbt.net>
Sun, 20 Oct 2013 04:32:04 +0000 (04:32 +0000)
commitd90eebe1e50e2bdb9632b64591e4b84cbc0049a1
treed6db0ea4f2300d1ba628bb1d4a0442e0ee37c375
parenta9dfd48f9668d0a6e04cf009cea0c4ede962144d
workaround reopen atomicity issues for stdio vs non-stdio

In multithreaded apps, we must use dup2/dup3 with a temporary
descriptor to reopen log files atomically.  This is the only way
to protect all concurrent userspace access to a file when reopening.

ref: http://bugs.ruby-lang.org/issues/9036
ref: yahns commit bcb10abe53cfb1d6a8ef7daef59eb10ced397c8a
lib/unicorn/util.rb