Subject: | [patch] tests hang on Windows |
This code hangs on Windows
flock($fh, LOCK_SH);
flock($fh, LOCK_EX);
Patch adds timeout to prevent hanging. It does not solve problems of locks.
--
Alexandr Ciornii, http://chorny.net
Subject: | RecordStore.pm.patch |
--- RecordStore.pm.dist 2018-04-02 22:38:10.000000000 +0300
+++ RecordStore.pm 2018-04-04 14:08:28.000000000 +0300
@@ -974,8 +974,18 @@
}
sub _lock_write {
my $fh = shift->[LOCK];
+ if ($^O eq 'MSWin32') {
+ my $try = 0;
+ while (1) {
+ return if flock( $fh, 2 + 4);
+ $try++;
+ die "cannot lock" if $try > 30;
+ sleep(1);
+ }
+ } else {
flock( $fh, 2 );
}
+}
sub _unlock {
my $fh = shift->[LOCK];
flock( $fh, 8 );