From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1034 invoked by alias); 20 Jul 2013 19:48:58 -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 1025 invoked by uid 89); 20 Jul 2013 19:48:58 -0000 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 Received: from Unknown (HELO sun60.bham.ac.uk) (147.188.128.137) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 20 Jul 2013 19:48:56 +0000 Received: from [147.188.128.54] (helo=bham.ac.uk) by sun60.bham.ac.uk with esmtp (Exim 4.72) (envelope-from ) id 1V0cr7-000373-PW for cygwin@cygwin.com; Sat, 20 Jul 2013 20:30:13 +0100 Received: from exhub03.bham.ac.uk ([147.188.244.205] helo=exhub03.adf.bham.ac.uk) by bham.ac.uk (envelope-from ) with esmtp (Exim 4.72) id 1V0cr7-0007gr-FY for cygwin@cygwin.com using interface smart2.bham.ac.uk; Sat, 20 Jul 2013 20:30:13 +0100 Received: from MBX08.adf.bham.ac.uk ([169.254.8.135]) by exhub03.adf.bham.ac.uk ([147.188.244.205]) with mapi id 14.03.0123.003; Sat, 20 Jul 2013 20:30:20 +0100 From: Daniel Brown To: "cygwin@cygwin.com" Subject: Win32 error in C program using openmp and fork() Date: Sat, 20 Jul 2013 21:26:00 -0000 Message-ID: <57302C57257EF2428CCAAF9BA83EC0448222C0EA@mbx08.adf.bham.ac.uk> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00406.txt.bz2 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 #include #include int main(void) { pid_t childPID; #pragma omp parallel { printf("I'm an openmp thread...\n"); } childPID =3D3D fork(); if(childPID >=3D3D 0) { if(childPID =3D3D=3D3D 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