X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=HiT+20jp8bNjjaXWTi8gl+kzDkp2NBkba39zvE18eoZxzCDkBmObW cIxov8ZUiQwQ+tkpdY+ZEPo1MXFO2V9WNQPEkOTHuyfM/8UMvXPqDWSAg5WVxJ83 teN91qTI2uCLIvkzybrQF2Yx6GvDPh5W8F37nYyshDGydqjKyq9Zuk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=3of/teFcQSkvQV95mjfVHWZdiTE=; b=GxaOYKbE5jdR8G/FJdCozoBdoUWU pwIJncLt5K06iSLM+kmdqWbWcjumizlfaa7RSgCMXwwmOsxbe9myGN7YPGHyW78H qjidSzmM2yG26SgX5k8lfyoQot8g9pReOC7ORZryvjNynGtK7nnvd7hGQLH8prJ7 OfoEcRniRy79dk8= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,URIBL_BLACK autolearn=no version=3.3.1 Date: Tue, 23 Jul 2013 15:08:51 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Win32 error in C program using openmp and fork() Message-ID: <20130723130851.GG9689@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <57302C57257EF2428CCAAF9BA83EC0448222C0EA AT mbx08 DOT adf DOT bham DOT ac DOT uk> <20130722080657 DOT GD2661 AT calimero DOT vinschen DOT de> <51EE7700 DOT 50803 AT star DOT sr DOT bham DOT ac DOT uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <51EE7700.50803@star.sr.bham.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) On Jul 23 13:28, Daniel Brown wrote: > I've wiped my old version of Cygwin and installed it fresh on my computer > and 1.7.21 doesn't work for me, either 32 or 64 bit. I have tried a > Win 7 x86 > virtual machine and it worked, on a Win 8 x86 virtual machine though I see > the same error. Therefore I guess it is a Windows 8 issue unless you are > running it? Yes, Windows 8/64 is my major test machine. > > I tried replacing the cygwin1.dll with the latest snapshots 1.7.22s x86 > and that still had the fork error. I have also tried running in safe > mode and > stopping all my anti-virus software just incase that was interfering > somehow. > So I get as an output now... > > Daniel AT XPS15z ~ > $ uname -r > 1.7.22s(0.268/5/3) > > Daniel AT XPS15z ~ > $ ./a.exe > I'm an openmp thread... > I'm an openmp thread... > I'm an openmp thread... > I'm an openmp thread... > Parent fork 1 [main] a 5832 C:\cygwin\home\Daniel\a.exe: *** fatal > error in forked process - failed > to create new win32 semaphore, currentvalue -2, Win32 error 87 > > However if I reduce the number of threads from 4 to 2 with: > > #pragma omp parallel num_threads(2) > { > printf("I'm an openmp thread...\n"); > } Ah, now there's something different. If I set the number of threads to 4, I can reproduce this problem almost every try with currentvalue -2, occassionally with currentvalue -1. > Looking at the source in thread.cc _fixup_after_fork() the win32 > error 87 is ERROR_INVALID_PARAMETER > which is due to currentvalue < 0. > > My only guess is that there is a race condition on the > currentvalue-- operations perhaps? Apparently. I investigate... Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat -- 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