Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <03f001c0c040$84aaa630$0200a8c0@lifelesswks> From: "Robert Collins" To: Cc: "Joost Kraaijeveld" References: <3AD06DB0 DOT 8756E06 AT yahoo DOT com> Subject: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2] Date: Mon, 9 Apr 2001 01:28:08 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-OriginalArrivalTime: 08 Apr 2001 15:21:42.0478 (UTC) FILETIME=[9D87F6E0:01C0C03F] > -------- Original Message -------- > Subject: FW: pthread_create problem in Cygwin 1.1.8-2 > Date: Sun, 8 Apr 2001 15:40:43 +0200 > From: Joost Kraaijeveld > To: "'earnie_boyd AT yahoo DOT com'" > > Hi Earnie, > > > I am using: > > Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.3-2/specs > gcc version 2.95.3-2 (cygwin special) > > Additional testing showes that if I insert a Sleep(500) in the > threadFunction() just before the return 0 it only crahes 3-5 times of > the 10 > runs. Also, it crashes more often after fast repeated runs of the > program. > It also crashes more often on faster hardware (I have tested on two > machines, PII 400 and a PIII 700, both 256 MB RAM). Running only 1 > thread > instead of two does not crash the program. This smells like a threads/exception handling interaction issue of some sort. It crashes for me, on i=99 at the same place. It crashes _every time_ for me. Adding a sleep as you did made it crash 8/10 instead of 10/10. Removing the return 0; from within the try {} stopped it crashing completely. Also, printf doesn't appear to be atomic and threadsafe (lines got interspersed). You might be hitting something there, but I doubt it (crashing in the wrong place). some things to test/do: 1) It's possible it's a problem with the thread exiting code, could you try using a pthread_exit call instead of return and report back. 2) What cygwin1.dll are you using? I'm using a custom build ~= to the latest snapshot. 2a) Earnie - what are you testing with? (as a control point that doesn't see the fault). 3) What's the value of ecx when it dies? Mine is (gdb) info register eax 0x407004 4222980 ecx 0xc0 192 3a) Earnie - if you have a few minutes, can you put a breakpoint on the offending instruction, and report back the output o info registers info locals info threads bt in each thread? Thanks, Rob > > If I run it through GDB it shows that the crash occurs after the "return > 0" > but before the closing bracket of the for loop (see the mixed output of > the > debugger source window below, the offending line is marked by me with a > "+"). It gives a SIGSEGV for both threads. > > > > Joost > > 10 { > 11 printf("%lu\n",i); > - 0x4010ac : add -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple