]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
ipc: get rid of lock support
authorEric Wong <e@80x24.org>
Wed, 3 May 2023 06:33:25 +0000 (06:33 +0000)
committerEric Wong <e@80x24.org>
Wed, 3 May 2023 08:18:43 +0000 (08:18 +0000)
SOCK_SEQPACKET is used whenever we care about parallel writes to
a socket, so there's no need to mess with locks in userspace
code.

lib/PublicInbox/IPC.pm
t/ipc.t

index cca3dacbe0abc6b05f84b6267567047cac834976..c154724e74159ef8c38bc6bae3356c68b419869b 100644 (file)
@@ -173,15 +173,6 @@ sub ipc_worker_stop {
        awaitpid($pid) if $$ == $ppid; # for non-event loop
 }
 
-# use this if we have multiple readers reading curl or "pigz -dc"
-# and writing to the same store
-sub ipc_lock_init {
-       my ($self, $f) = @_;
-       $f // die 'BUG: no filename given';
-       require PublicInbox::Lock;
-       $self->{-ipc_lock} //= bless { lock_path => $f }, 'PublicInbox::Lock'
-}
-
 sub _wait_return ($$) {
        my ($r_res, $sub) = @_;
        my $ret = _get_rec($r_res) // die "no response on $sub";
@@ -193,8 +184,6 @@ sub _wait_return ($$) {
 sub ipc_do {
        my ($self, $sub, @args) = @_;
        if (my $w_req = $self->{-ipc_req}) { # run in worker
-               my $ipc_lock = $self->{-ipc_lock};
-               my $lock = $ipc_lock ? $ipc_lock->lock_for_scope : undef;
                if (defined(wantarray)) {
                        my $r_res = $self->{-ipc_res} or die 'no ipc_res';
                        _send_rec($w_req, [ wantarray, $sub, @args ]);
diff --git a/t/ipc.t b/t/ipc.t
index fd4d559962c877d7125f3d554b41721558bf710a..7bdf22189b954d125063a4e72796d26538bcf3b2 100644 (file)
--- a/t/ipc.t
+++ b/t/ipc.t
@@ -90,7 +90,6 @@ $test->('local');
        defined($pid) or BAIL_OUT 'no spawn, no test';
        is($ipc->ipc_do('test_pid'), $pid, 'worker pid returned');
        $test->('worker');
-       $ipc->ipc_lock_init("$tmpdir/lock");
        is($ipc->ipc_do('test_pid'), $pid, 'worker pid returned');
        $ipc->ipc_worker_stop;
        ok(!kill(0, $pid) && $!{ESRCH}, 'worker stopped');