delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/23/09:15:36

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:from:to:subject:date:message-id:content-type
:content-transfer-encoding:mime-version; q=dns; s=default; b=nNh
mqUruY28hUFhXxjTJcyVKeutSakkypDBCjjI5Zchi5b6XR/ndxgX7jsZjiFgSDfy
vhHAYfI+ItaYRiNsEq9N/4JovDypApeEP3akD3udmsGIqJ3O5cQ98k+EA1kk7+2u
sCUJ+yKt+ibbrw9fo8PYqs6SNfr2UL6+Y7u1IbDc=
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:from:to:subject:date:message-id:content-type
:content-transfer-encoding:mime-version; s=default; bh=XH2Jl5tTK
YL4ZdMV8OkOrsHDmTk=; b=uhbeD6hD8+PY9TCIURUWpJ6D2k/jo+c2SCcV5KE9/
mCQg1Rks7qJYhja+0Hzbg+z6Hot1SVTeluT68zyTJH9W9W9jsiyx91vTmGtqBVC9
3aHKxOQ8v55mz9jdOvFjk+J03Zd6t7gQUoyQA3qU3WZmpxNl2SW38Z9o1byhQ/GU
FU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=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
From: Daniel Brown <DDB707 AT bham DOT ac DOT uk>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: Win32 error in C program using openmp and fork()
Date: Tue, 23 Jul 2013 09:03:58 +0000
Message-ID: <57302C57257EF2428CCAAF9BA83EC0448222E6A7@mbx08.adf.bham.ac.uk>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r6NDFWgR007585

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?

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");
}

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 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?

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019