www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/22/04:07:22

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=LC6E03Y5j481SAahqNTJna9SvywAYfZflQT/i1l6KlrJDV/NMnMC9
rp6MfKTOwDhaRR0korDERe+/aK/gkkDrc+3v9D1XX+ZWzNqYpaiGm0TEDyPtTdaS
MSfkf9bbjq/kIb88Pr8gkWXj2ovYkjUm+FEVzCGWIv/8okg4O2OsUc=
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=uTJbv3HekyWNPMYkiyVt+xUh5eU=; b=TrQh23FT0mgfXFIdSN48XfEr+LcK
yrdNEo/mWXybz+j76uK6UZJtCphuJdhJbHXTiKN/5onYpBACKDzpVzuBoMHbrNS1
ty4gRFT7vZx8R3gMx21g5nhz2uOpYgVpsg0wGmiFeuU4jw60Ra/HnF17QZrlW+tv
rzmivQ0yYc/XmbQ=
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=0.1 required=5.0 tests=AWL,BAYES_50,RDNS_NONE autolearn=no version=3.3.1
Date: Mon, 22 Jul 2013 10:06:57 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Win32 error in C program using openmp and fork()
Message-ID: <20130722080657.GD2661@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>
MIME-Version: 1.0
In-Reply-To: <57302C57257EF2428CCAAF9BA83EC0448222C0EA@mbx08.adf.bham.ac.uk>
User-Agent: Mutt/1.5.21 (2010-09-15)

On Jul 20 19:30, Daniel Brown wrote:
> Hi,
> 
> So I have some code I am trying to port to Cygwin but I am getting the
> error:
> 
> fatal error in forked process - failed to create new win32 semaphore,
> Win32 error 87
> 
> when calling fork() in a C program when openmp code has been used
> beforehand. I've got the following test code which reduces the problem
> down to as little code as I could:
> 
> #include <stdio.h>
> #include <omp.h>
> #include <sys/types.h>
> 
> int main(void)
> {
>      pid_t childPID;
> 
>      #pragma omp parallel
>      {
>          printf("I'm an openmp thread...\n");
>      }
> 
>      childPID =3D fork();
> 
>      if(childPID >=3D 0) {
>          if(childPID =3D=3D 0) {
>              printf("Child fork\n");
>          } else {
>              printf("Parent fork\n");
>          }
>      } else {
>          printf("Fork failed");
>          return 1;
>      }
> 
>      return 0;
> }
> 
> To build I just use "gcc -fopenmp para.c" and the output I get is...
> 
> I'm an openmp thread...
> I'm an openmp thread...
> I'm an openmp thread...
> I'm an openmp thread...
> Parent fork 0 [main] a 18640 D:\usr\code\c\a.exe: *** fatal error
> in forked process - failed to create new win32 semaphore, Win32 error
> 87

I didn't try with 1.7.20, but with the current 1.7.21 and with the
latest snapshot from http://cygwin.com/snapshots/, on 32 and 64 bit,
and this is what I get on both cases:

  $ uname -r
  1.7.21(0.267/5/3)
  $ gcc -g -fopenmp -o openmp-test openmp-test.c
  $ ./openmp-test
  I'm an openmp thread...
  I'm an openmp thread...
  Parent fork
  Child fork
  $


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

- Raw text -


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