tags:

views:

63

answers:

1

Hi,

I am using libstdc++ on MAC for developing extensions for firefox. I am getting crashes inside libstdc+ library when I am referring to it across multiple firefox extensions. I was thinking whether libstdc++ for XCode compiler is reentrant or not. If not, is there any version of libstdc++ is available with is reentrant ?

+2  A: 

See the HOWTO at http://www.cs.huji.ac.il/~etsman/Docs/gcc-3.4-base/libstdc++/html/17_intro/howto.html , specifically the section entitled "The Standard C++ library and multithreading".

Vicky
Eugen Constantin Dinca
@Eugen Constantin Dinca: I realise that (although I admit I could have made it clearer in my answer). However, a non-thread-safe function certainly is not going to be re-entrant, and it reads to me as though there may be issues with thread-safety in the libstdc++ implementation, depending on how the app has been built.
Vicky
@Vicky: Not necessarily, i.e. if for thread safety you uses a non-recursive mutex you have a thread safe function which is not reentrant... (note that I'm not promoting the usage of recursive mutexes)
Eugen Constantin Dinca
@Eugin Constantin Dinca: Yes, you can have a thread-safe function which is not re-entrant, but you can't have a re-entrant function that is not thread-safe. Thread-safety is one of the requirements for re-entrancy.
Vicky
@Vicky: "you can't have a re-entrant function that is not thread-safe": only if the data it's called with is not shared/accessible between threads.
Eugen Constantin Dinca