C++ Exceptions Thread Safe?

We’re having a heck of a time with a large multithreaded C++ application.
Exceptions commonly work properly, but sometimes they cause a SIGSEV before
they’re caught. It’s possible it’s something in our code, but it sure looks
like it’s not at this point.

Our compile command is:

cc -lang-c++ -Wall -Wno-reorder -nopipe -gstabs+ -c -o foo.o foo.cpp

We put our object into libraries with:

cc -A fooLib.A foo.o

And build the executable with:

cc -lang-c++ -M -nopipe -gstabs+ -o foo fooMain.o -Wl,–start-group fooLib.a
otherLib.a -lsocket -Wl,–end-group

  1. Do you KNOW that C++ exceptions are thread safe?

  2. Is something wrong with our build commands?

Thanks,


Marty Doane
Siemens Dematic

Exceptions are threadsafe. Could you be running out of stack space?

Marty Doane <marty.doane@rapistan.com> wrote:

We’re having a heck of a time with a large multithreaded C++ application.
Exceptions commonly work properly, but sometimes they cause a SIGSEV before
they’re caught. It’s possible it’s something in our code, but it sure looks
like it’s not at this point.

Our compile command is:

cc -lang-c++ -Wall -Wno-reorder -nopipe -gstabs+ -c -o foo.o foo.cpp

We put our object into libraries with:

cc -A fooLib.A foo.o

And build the executable with:

cc -lang-c++ -M -nopipe -gstabs+ -o foo fooMain.o -Wl,–start-group fooLib.a
otherLib.a -lsocket -Wl,–end-group

  1. Do you KNOW that C++ exceptions are thread safe?

  2. Is something wrong with our build commands?

Thanks,


Marty Doane
Siemens Dematic



cburgess@qnx.com

I thought the stack dynamically grows to meet the needs. Educate me.


Marty Doane
Siemens Dematic

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:afv18l$f2l$2@nntp.qnx.com

Exceptions are threadsafe. Could you be running out of stack space?

Marty Doane <> marty.doane@rapistan.com> > wrote:
We’re having a heck of a time with a large multithreaded C++
application.
Exceptions commonly work properly, but sometimes they cause a SIGSEV
before
they’re caught. It’s possible it’s something in our code, but it sure
looks
like it’s not at this point.

Our compile command is:

cc -lang-c++ -Wall -Wno-reorder -nopipe -gstabs+ -c -o foo.o foo.cpp

We put our object into libraries with:

cc -A fooLib.A foo.o

And build the executable with:

cc -lang-c++ -M -nopipe -gstabs+ -o foo fooMain.o -Wl,–start-group
fooLib.a
otherLib.a -lsocket -Wl,–end-group

  1. Do you KNOW that C++ exceptions are thread safe?

  2. Is something wrong with our build commands?

Thanks,


Marty Doane
Siemens Dematic




\

cburgess@qnx.com

I don’t think it grows beyond ‘virtual’ size. Colin?

– igor

“Marty Doane” <marty.doane@rapistan.com> wrote in message
news:afva2j$3r0$1@inn.qnx.com

I thought the stack dynamically grows to meet the needs. Educate me.


Marty Doane
Siemens Dematic

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:afv18l$f2l$> 2@nntp.qnx.com> …
Exceptions are threadsafe. Could you be running out of stack space?

Marty Doane <> marty.doane@rapistan.com> > wrote:
We’re having a heck of a time with a large multithreaded C++
application.
Exceptions commonly work properly, but sometimes they cause a SIGSEV
before
they’re caught. It’s possible it’s something in our code, but it sure
looks
like it’s not at this point.

Our compile command is:

cc -lang-c++ -Wall -Wno-reorder -nopipe -gstabs+ -c -o foo.o foo.cpp

We put our object into libraries with:

cc -A fooLib.A foo.o

And build the executable with:

cc -lang-c++ -M -nopipe -gstabs+ -o foo fooMain.o -Wl,–start-group
fooLib.a
otherLib.a -lsocket -Wl,–end-group

  1. Do you KNOW that C++ exceptions are thread safe?

  2. Is something wrong with our build commands?

Thanks,


Marty Doane
Siemens Dematic




\

cburgess@qnx.com

A thread’s stack will grow, getting new pages allocated to it as necessary,
until it hits the limit defined at the time of its creation, at which point
the attempted touch of the “guard page” will cause a segfault. Exceptions
mostly involve unwinding frames off the stack, but only after they’re caught
(throwing them actually consumes some extra space). I mention this in case
anyone found Colin’s suggestion counterintuitive :slight_smile:

dB

“Igor Kovalenko” <Igor.Kovalenko@motorola.com> wrote in message
news:afvels$6v5$1@inn.qnx.com

I don’t think it grows beyond ‘virtual’ size. Colin?

– igor

“Marty Doane” <> marty.doane@rapistan.com> > wrote in message
news:afva2j$3r0$> 1@inn.qnx.com> …
I thought the stack dynamically grows to meet the needs. Educate me.


Marty Doane
Siemens Dematic

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:afv18l$f2l$> 2@nntp.qnx.com> …
Exceptions are threadsafe. Could you be running out of stack space?

Marty Doane <> marty.doane@rapistan.com> > wrote:
We’re having a heck of a time with a large multithreaded C++
application.
Exceptions commonly work properly, but sometimes they cause a SIGSEV
before
they’re caught. It’s possible it’s something in our code, but it
sure
looks
like it’s not at this point.

Our compile command is:

cc -lang-c++ -Wall -Wno-reorder -nopipe -gstabs+ -c -o foo.o foo.cpp

We put our object into libraries with:

cc -A fooLib.A foo.o

And build the executable with:

cc -lang-c++ -M -nopipe -gstabs+ -o foo fooMain.o -Wl,–start-group
fooLib.a
otherLib.a -lsocket -Wl,–end-group

  1. Do you KNOW that C++ exceptions are thread safe?

  2. Is something wrong with our build commands?

Thanks,


Marty Doane
Siemens Dematic




\

cburgess@qnx.com
\