diff options
author | Eric Wong <e@80x24.org> | 2021-01-13 19:06:24 -1200 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-01-15 00:19:07 +0000 |
commit | f49d6a9ac8ff542c625e909798ef0947df45f34e (patch) | |
tree | e0623d0650944220dfa324273ec927dd23c56901 /lib/PublicInbox/Lock.pm | |
parent | c7b789a770bbe9bbc262af850d863dee4efe8371 (diff) | |
download | public-inbox-f49d6a9ac8ff542c625e909798ef0947df45f34e.tar.gz |
Most writes to stdout aren't atomic and we need locking to prevent workers from interleaving and corrupting JSON output. The one case stdout won't require locking is if it's pointed to a regular file with O_APPEND; as POSIX O_APPEND semantics guarantees atomicity.
Diffstat (limited to 'lib/PublicInbox/Lock.pm')
-rw-r--r-- | lib/PublicInbox/Lock.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/Lock.pm b/lib/PublicInbox/Lock.pm index 2c5ebf27..bb213de4 100644 --- a/lib/PublicInbox/Lock.pm +++ b/lib/PublicInbox/Lock.pm @@ -37,7 +37,7 @@ sub lock_release { # caller must use return value sub lock_for_scope { my ($self, @single_pid) = @_; - $self->lock_acquire; + lock_acquire($self) or return; # lock_path not set PublicInbox::OnDestroy->new(@single_pid, \&lock_release, $self); } |