This is the mail archive of the
mailing list for the Cygwin project.
Multi-threaded application using STL crashes
- From: Jeff Terrell <jeff at kc dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 22 Apr 2005 09:17:03 +0100
- Subject: Multi-threaded application using STL crashes
I'm developing a multi-threaded application that makes extensive use of STL.
The number of threads is configurable.
If I build the application to run in one thread, it's fine. However, if I
application to run in 2 or more threads, it crashes in an unpredictable manner.
I'm taking all the usual safeguards to protect shared resources (semaphores,
critical sections etc), although I'm not building the application any
from the way that I build single-threaded applications - I'm not aware that I
I've worked around some crashes, e.g.
1. I've replaced one use of std::vector with a proprietary solution because
the application kept crashing in vector::resize().
2. I've had to add a call to vector::reserve() in another use of vector before
making calls to vector::push_back(), to prevent the application from
The fundamental questions I'd like to ask are:
1. Are there problems with using STL in multi-threaded applications.
2. Do I have to build multi-threaded applications in a particular way.
Many thanks in anticipation.
Here are the details of my platform:
> uname -a
CYGWIN_NT-5.1 Tesla 1.5.11(0.116/4/2) 2004-09-04 23:17 i686 unknown unknown
> g++ --version
g++ (GCC) 3.3.3 (cygwin special)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html