delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/20/15:49:14

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=czd
15YNeEi7+lKgq23R2AX/3mMfhD0JDz38GPHWdhc3j7civTJCgtz9qaOYSHlZtfb/
ompBpSfzh1nBoF1GTjG/VxsfgdKakgY6srG1q4M96md7O+WF2FA6xkzVyUBaMLCK
Xw8r67PL9cbU0tuo+iHEP07Ak3tBPYa7lSsyjInM=
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=SuAdGksJ4
pWdPctU8I6t2qV+MFY=; b=GqVMKVio6PrWh+M64T246I7VRamjbw16U1COr0rjk
0mbV78VC9WHd4L7iEFCb9Mbj00U3m2dzyvWQ2YY7LJQd+k7iKmlgGtN6ybbmq3t3
93UFQhFqNZ3muCf+zMjfo6LjqaitVQljdgLEB9f9e1JbR3bCWjBlTipbrjW0RIBG
7A=
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.3 required=5.0 tests=BAYES_50,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RDNS_NONE autolearn=ham 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: Win32 error in C program using openmp and fork()
Date: Sat, 20 Jul 2013 19:30:19 +0000
Message-ID: <57302C57257EF2428CCAAF9BA83EC0448222C0EA@mbx08.adf.bham.ac.uk>
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r6KJnAMT032285

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 have tried doing a rebaseall as I had similar error in the past but it
didn't fix it. I have also tried a clean install on a separate Windows
2008 R2 machine which didn't work either.

The version of GCC is 4.7.3 and I am on Windows 8 Professional
64-bit, Cygwin 1.7.20(0.266/5/3).

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