From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46369 invoked by alias); 13 Nov 2015 18:25:36 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 46356 invoked by uid 89); 13 Nov 2015 18:25:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f170.google.com Received: from mail-qk0-f170.google.com (HELO mail-qk0-f170.google.com) (209.85.220.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 13 Nov 2015 18:25:34 +0000 Received: by qkcl124 with SMTP id l124so56179726qkc.3 for ; Fri, 13 Nov 2015 10:25:32 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.140.99.6 with SMTP id p6mr22718166qge.76.1447439132415; Fri, 13 Nov 2015 10:25:32 -0800 (PST) Received: by 10.140.96.55 with HTTP; Fri, 13 Nov 2015 10:25:32 -0800 (PST) In-Reply-To: <20151112122809.GB1774@calimero.vinschen.de> References: <20151112122809.GB1774@calimero.vinschen.de> Date: Fri, 13 Nov 2015 18:25:00 -0000 Message-ID: Subject: Re: 2.3.0: possible Cygwin flock bug (Windows 10 x86_64) From: Mario Roy To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-11/txt/msg00206.txt.bz2 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 => \&func, },{ use_threads => 0, max_workers => 8, user_func => \&func, },{ use_threads => 1, max_workers => 8, user_func => \&func, },{ use_threads => 0, max_workers => 8, user_func => \&func, },{ use_threads => 1, max_workers => 8, user_func => \&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