From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C6A441F44D for ; Thu, 28 Mar 2024 10:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1711621182; bh=0O9rYoOVPJYoilABxlKKdHW8rhPDsRGUHP7GAbwqemM=; h=From:To:Subject:Date:From; b=vI9pOWcVf087AmyK25itHvCwywJuQpN1+nibzyl7DV6tGXJAo0MPhZT3W7ogFmVOM pKeNZBRotFPZmeiFvkkv79PLdmVhWtoG1dnSea8gVor/FiM910T9S9GPCdCqYKtxq2 NzE7EXKtIm7+IQLw9nppgvZMQOYEwo9C5cARs/zk= From: Eric Wong To: spew@80x24.org Subject: [PATCH 1/3] lock: get rid of PID guard Date: Thu, 28 Mar 2024 10:19:40 +0000 Message-ID: <20240328101942.639911-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: PID guards for OnDestroy will be the default in an upcoming change. In the meantime, LeiMirror was the only user and didn't actually need it. --- lib/PublicInbox/LeiMirror.pm | 2 +- lib/PublicInbox/Lock.pm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 5353ae61..4e3e1d1c 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -856,7 +856,7 @@ sub v2_done { # called via OnDestroy my $dst = $self->{cur_dst} // $self->{dst}; require PublicInbox::Lock; my $lk = PublicInbox::Lock->new("$dst/inbox.lock"); - my $lck = $lk->lock_for_scope($$); + my $lck = $lk->lock_for_scope; _write_inbox_config($self); require PublicInbox::MultiGit; my $mg = PublicInbox::MultiGit->new($dst, 'all.git', 'git'); diff --git a/lib/PublicInbox/Lock.pm b/lib/PublicInbox/Lock.pm index ddaf3312..2a5a0f30 100644 --- a/lib/PublicInbox/Lock.pm +++ b/lib/PublicInbox/Lock.pm @@ -41,9 +41,9 @@ sub lock_release { # caller must use return value sub lock_for_scope { - my ($self, @single_pid) = @_; + my ($self) = @_; lock_acquire($self) or return; # lock_path not set - PublicInbox::OnDestroy->new(@single_pid, \&lock_release, $self); + PublicInbox::OnDestroy->new(\&lock_release, $self); } sub lock_acquire_fast { @@ -58,9 +58,9 @@ sub lock_release_fast { # caller must use return value sub lock_for_scope_fast { - my ($self, @single_pid) = @_; + my ($self) = @_; lock_acquire_fast($self) or return; # lock_path not set - PublicInbox::OnDestroy->new(@single_pid, \&lock_release_fast, $self); + PublicInbox::OnDestroy->new(\&lock_release_fast, $self); } 1;