user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] ipc: get rid of lock support
@ 2023-05-03  6:33  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-05-03  6:33 UTC (permalink / raw)
  To: meta

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.
---
 I only noticed this since I was poking around in ~/.local/share/lei/store
 created from a pre-release and noticed ipc.lock lingering...

 lib/PublicInbox/IPC.pm | 11 -----------
 t/ipc.t                |  1 -
 2 files changed, 12 deletions(-)

diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm
index cca3dacb..c154724e 100644
--- a/lib/PublicInbox/IPC.pm
+++ b/lib/PublicInbox/IPC.pm
@@ -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 fd4d5599..7bdf2218 100644
--- 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');

^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-05-03  6:33  7% [PATCH] ipc: get rid of lock support Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).