From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24769 invoked by alias); 23 Jul 2013 13:15:20 -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 24754 invoked by uid 89); 23 Jul 2013 13:15:19 -0000 X-Spam-SWARE-Status: No, score=3.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RDNS_NONE,URIBL_BLACK autolearn=no version=3.3.1 Received: from Unknown (HELO sun61.bham.ac.uk) (147.188.128.150) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 23 Jul 2013 13:15:18 +0000 Received: from [147.188.128.54] (helo=bham.ac.uk) by sun61.bham.ac.uk with esmtp (Exim 4.72) (envelope-from ) id 1V1YVi-00065g-OI for cygwin@cygwin.com; Tue, 23 Jul 2013 10:03:58 +0100 Received: from exhub01.bham.ac.uk ([147.188.135.84] helo=exhub01.adf.bham.ac.uk) by bham.ac.uk (envelope-from ) with esmtp (Exim 4.72) id 1V1YVf-000302-E8 for cygwin@cygwin.com using interface smart2.bham.ac.uk; Tue, 23 Jul 2013 10:03:58 +0100 Received: from MBX08.adf.bham.ac.uk ([169.254.8.135]) by exhub01.adf.bham.ac.uk ([147.188.135.84]) with mapi id 14.03.0123.003; Tue, 23 Jul 2013 10:03:58 +0100 From: Daniel Brown To: "cygwin@cygwin.com" Subject: Re: Win32 error in C program using openmp and fork() Date: Tue, 23 Jul 2013 14:22:00 -0000 Message-ID: <57302C57257EF2428CCAAF9BA83EC0448222E6A7@mbx08.adf.bham.ac.uk> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2013-07/txt/msg00480.txt.bz2 I've wiped my old version of Cygwin and installed it fresh on my computer a= nd 1.7.21 doesn't work for me, either 32 or 64 bit. I have tried a Win 7 x8= 6 virtual machine and it worked, on a Win 8 x86 virtual machine though I se= e the same error. Therefore I guess it is a Windows 8 issue unless you are = running it? 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 someho= w. So I get as an output now... Daniel@XPS15z ~ $ uname -r 1.7.22s(0.268/5/3) Daniel@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"); } it works fine, if I use 3 threads then the error comes back. Interestingly = the the value of currentvalue changes each time I run the program if I use = 4 or more threads, if I use 3 then it is always -1. Looking at the source in thread.cc _fixup_after_fork() the win32 error 87 i= s ERROR_INVALID_PARAMETER which is due to currentvalue < 0. My only guess is that there is a race condition on the currentvalue-- opera= tions perhaps? Thanks, Daniel -- 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