public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob fb305f9682af1ab94c9dbb836d1b22eb489031e7 538 bytes (raw)
$ git show HEAD:t/pop3d_lock.t	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use v5.12;
use PublicInbox::TestCommon;
require_mods(qw(DBD::SQLite Net::POP3 :fcntl_lock));
use autodie;
my $tmpdir = tmpdir;
require_ok 'PublicInbox::POP3D';
my $pop3d = bless {}, 'PublicInbox::POP3D';
open $pop3d->{txn_fh}, '+>>', "$tmpdir/txn.lock";
use Fcntl qw(F_SETLK F_UNLCK F_WRLCK);

ok $pop3d->_setlk(l_type => F_WRLCK, l_start => 9, l_len => 1),
	'locked file (check with ktrace/strace)';

done_testing;

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git