Re: 2.3.0: possible Cygwin flock bug (Windows 10 x86_64)

2015-11-13 Thread Mario Roy
Hello Corinna,

I am writing to confirm that file locking, with MCE 1.608, utilizing
the development snapshot 2015-11-12 x86_64 is passing 100%. I ran
through other test cases including mixing threads and child processes.

Currently, MCE 1.608 does not allow one to mix threads and child
processes under Cygwin. I commented out the check in
MCE-1.608/lib/MCE.pm  (lines 424 - 435).

The following (mixing threads and child processes) now runs on Cygwin
using flock. Hurray !!!

use threads;
use threads::shared;
use MCE;

sub func {
   my ($mce) = @_;
   $mce->say($mce->wid);
}

my $mce = MCE->new(
 mutex_type => 'channel',
 user_tasks =>[{
use_threads => 0,
max_workers => 8,
user_func   => \,
 },{
use_threads => 0,
max_workers => 8,
user_func   => \,
 },{
use_threads => 1,
max_workers => 8,
user_func   => \,
 },{
use_threads => 0,
max_workers => 8,
user_func   => \,
 },{
use_threads => 1,
max_workers => 8,
user_func   => \,
 }]
)->run;


The decision with channel locking for the upcoming MCE 1.7 release is
for another reason. In Perl, each worker must obtain the file lock
handle including threads. There are ulimit restrictions for number of
open file handles. With channel locking, workers are not having to
re-open any handles. Thus allowing the process to run with more
threads.

Recently, I simplified MCE/Mutex.pm to do channel locking only. Not to
worry, I may have MCE::Mutex support both channel and file locking.
Thus, will do the following for the upcoming MCE 1.700.

MCE-1.700/lib/MCE/Mutex.pm
MCE-1.700/lib/MCE/Mutex/Channel.pm
MCE-1.700/lib/MCE/Mutex/Flock.pm

Then, one may specify the type desired.

use MCE::Mutex;

my $m1 = MCE::Mutex->new( type => 'channel' );# default if type is
not specified
my $m2 = MCE::Mutex->new( type => 'flock' );

Channel locking supports lock and unlock only.

$m1->lock; # similarly to LOCK_EX
$m1->unlock; # similarly to LOCK_UN

Will add the shared method for LOCK_SH in MCE/Mutex/Flock.pm

$m2->lock;
$m2->unlock;
$m2->shared;

MCE 1.700 in Github runs well with channel locking across the board.
However, being able to obtain a shared lock (possible with file
locking) at the application level is nice. Seeing the above example
work makes me confident in bringing back file locking and know that it
will work across platforms including Cygwin.

Thank you for fixing flock in Cygwin.dll.

Regards,
Mario

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: failure notice

2015-11-11 Thread Mario Roy
File locking is failing with Cygwin 2.4.0-0.2 as well. Thank you for
allowing the possibility of downgrading the Cygwin base package down
to 2.2.1-1 via setup.

Best regards,
Mario

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



2.3.0: possible Cygwin flock bug (Windows 10 x86_64)

2015-11-11 Thread Mario Roy
Greetings,

During testing of the Perl MCE 1.608 module (uses flock), the examples
scripts hang. Downgrading the base Cygwin package from 2.3.0-1 to
2.2.1-1 resolves the issue.

Installation is not required if a Cygwin developer desires to test
file locking via the Perl MCE module.

https://cpan.metacpan.org/authors/id/M/MA/MARIOROY/MCE-1.608.tar.gz

1. extract tar file
2. cd MCE-1.608/examples
3. perl foreach.pl 10

Hangs with Cygwin 2.3.0-1
Successful with Cygwin 2.2.1-1

The upcoming Perl MCE 1.7 release does away with file locking and
works with 2.3.0-1. The next commit into GitHub (in a day or two) will
contain optimizations allowing Perl MCE on Windows and Cygwin to run
at full speed with lesser overhead.

Best regards,
Mario

p.s. Thank you for Cygwin

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple