delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/07/16:46:42

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3AA6A73D.311560E1@mip.sdu.dk>
Date: Wed, 07 Mar 2001 22:25:17 +0100
From: =?iso-8859-1?Q?Ren=E9=20M=F8ller?= Fonseca <fonseca AT mip DOT sdu DOT dk>
Organization: MIP, University of Southern Denmark
X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: CYGWIN - GCC - C++ - multi-threaded apps - ACCESS VIOLATION

Hi,

I'm currently trying to make working multi threaded C++ applications
that utilize the win32 api directly (I do not use the POSIX threads
implementation). I'm getting ACCESS VIOLATIONs (win32 exception
0xc0000005) nearly on every run of my applications.

Looking at the assembler code generated from the C++ code it seems to me
that the threads use a shared table for exception handling. At some
point an entry of the table is read and dereferenced a number of times
and finally . Its the dereference that allways results in the ACCESSS
VIOLATION (mostly a dereference of a zero pointer but not allways). Can
anyone confirm or deny this?

Additional notes:
  1. The problem seems to occur only at the end of a scope.
  2. The problem gets worse if I instantiate temporary objects on the
stack.
  3. The problem seems to disappear when the threads do not call the
win32 api (calling Sleep(0) will most likely result in an access
violation).

Can I do something to make the C++ code multi thread safe by providing
each thread context its own table for exception handling (if thats the
problem) by calling some functions in libgcc.a at the entry point of the
threads.

Are there anyone out there who have built working multi threaded C++
apps in the cygwin environment?

I have tried different versions of GCC 2.95... (all based on 19991024)
including prebuilt MINGW distributions and have found no differences in
the behaviour.

I'm running similar apps under Linux (using "gcc version 2.96 20000731
(Red Hat Linux 7.0)") without experiencing any segmentation faults.

Hope, somebody can help me out.

Thanks,
René

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019