| delorie.com/archives/browse.cgi | search |
| 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:message-id:date:from:mime-version:to:subject | |
| :references:in-reply-to:content-type:content-transfer-encoding; | |
| q=dns; s=default; b=eac0o14xGih6WbOgWnQ+CAxq03DtloNA2BtShPYIiyY | |
| RRggboiunUvJ3GJkssQzjVmEswVCL2TVAQUleApvNAfNjROucEef8ykHq84AvloV | |
| TgjZr/QTdixQO7L0AGm3rtz2ic87N6mQ7P61C0IvHImtqYj93zwxM0oicPzNHJQo | |
| = | |
| 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:message-id:date:from:mime-version:to:subject | |
| :references:in-reply-to:content-type:content-transfer-encoding; | |
| s=default; bh=upIykhXRr/8e6JZIAFuukDHQmT8=; b=wK4TEmBb8XGk1zW/F | |
| xbDKfMtiHzuXsjZJViJXKbNYZ+Gxb3Vr/EWfxGomFBNONjfVnz0vdrlkopQg4k8l | |
| e3Eb8/7/wFXjdEecvuQZJkeTDxPUejU5x5rB/UgGIIweNh7YAMLuBt6joOxA6auI | |
| 8SdoKldKC0OHBJSGR3YYw37YZI= | |
| 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=2.3 required=5.0 tests=AWL,BAYES_05,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RDNS_NONE,URIBL_BLACK autolearn=no version=3.3.1 |
| Message-ID: | <51EFCE28.8090904@star.sr.bham.ac.uk> |
| Date: | Wed, 24 Jul 2013 13:52:56 +0100 |
| From: | Daniel Brown <ddb AT star DOT sr DOT bham DOT ac DOT uk> |
| User-Agent: | Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Win32 error in C program using openmp and fork() |
| References: | <57302C57257EF2428CCAAF9BA83EC0448222C0EA AT mbx08 DOT adf DOT bham DOT ac DOT uk> <20130722080657 DOT GD2661 AT calimero DOT vinschen DOT de> <51EE7700 DOT 50803 AT star DOT sr DOT bham DOT ac DOT uk> <20130723130851 DOT GG9689 AT calimero DOT vinschen DOT de> <20130723141855 DOT GH9689 AT calimero DOT vinschen DOT de> <20130723143910 DOT GI9689 AT calimero DOT vinschen DOT de> |
| In-Reply-To: | <20130723143910.GI9689@calimero.vinschen.de> |
Works perfectly! Been running my code since yesterday and no issues so far.
Thanks for the quick fix,
Daniel
On 23/07/2013 15:39, Corinna Vinschen wrote:
> On Jul 23 16:18, Corinna Vinschen wrote:
>> On Jul 23 15:08, Corinna Vinschen wrote:
>>> On Jul 23 13:28, Daniel Brown wrote:
>>>> 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");
>>>> }
>>> Ah, now there's something different. If I set the number of threads to
>>> 4, I can reproduce this problem almost every try with currentvalue -2,
>>> occassionally with currentvalue -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?
>>> Apparently. I investigate...
>> Yes, there was a race condition in setting the value of the semaphore
>> private "currentvalue" member. The only reason to keep track of the
>> value is to allow _fixup_after_fork to set the right value, but here the
>> race comes into play. I redesigned this part so that it only sets
>> currentvalue once, right from fork itself, to propagate the correct
>> value to the child process.
>>
>> I'm just building new 32 and 64 bit snapshots. They should be available
>> on http://cygwin.com/snapshots/ in an hour at the latest. Please give
>> it a try.
> Both snapshots are up. Test away.
>
>
> Corinna
>
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |