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 Subject: RE: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2] MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 content-class: urn:content-classes:message Date: Mon, 9 Apr 2001 11:31:57 +1000 Message-ID: Thread-Topic: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2] Thread-Index: AcDAhmyVy51UsyQ6T0WSHLL8MfwLCgAASgAgAAMIhFA= From: "Robert Collins" To: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id VAA12283 > -----Original Message----- > From: Robert Collins > Sent: Monday, April 09, 2001 11:14 AM > To: cygwin AT cygwin DOT com > Subject: RE: G++ guru's please comment - Re: FW: > pthread_create problem > in Cygwin 1.1.8-2] > > > > I will, once I have a good binary to compare with. I don't know what > return 0; in a try{} should look like. > > Just for fun I removed the printf, and the crash went away. It also > never appears with only one thread running. > > I've had a quick read of the asembly and will report back. > I haven't got time for an exhaustive session on this during the workday. I'll look at it more at home tonight. It's definately not printf() trashing ecx - I have a slightly more trivial test case below. I'd really appreciate a non-stripped working binary of the test case below so I can track this down a little more quickly. BTW Chris - esp looks fine to me, it's just ecx that's getting trashed. If someone tries to build this, you will need a snapshot to have the sched_yield() function. The bug isn't in the pthread code AFAICT - Joost is on 1.1.8, and I'm on my new code, and we both have the same symptoms. From what I can see so far the exception is related to the thread exiting within the try {} block after the thread function has lost the processor to another instance of the same function. sched_yield() simply forces that to occur. (going out on a limb) This may be something solvable by building gcc with pthread exception handling as Mumit suggested. Rob Build with this makefile: === Makefile === all: AlibTest.exe Main.o: main.cpp g++ -c -mthreads -g -O0 -Wall -o"Main.o" main.cpp AlibTest.exe: Main.o g++ -mthreads -o./ALibTest.exe Main.o === main.cpp === #include #include #include #include void *threadFunction(void * arg) { try { sched_yield(); return 0; } catch(...) { } return 0; } int main() { pthread_t t1; pthread_t t2; pthread_create(&t1, NULL, threadFunction, NULL); pthread_create(&t2, NULL, threadFunction, NULL); Sleep(3000); return 0; } -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple