multithreaded c++ program gives segmentation fault coredump

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nrhayyal

    #1

    multithreaded c++ program gives segmentation fault coredump

    hi guys,
    i am using AIX 5.2 OS and working on c++ and the compiler is gcc-3.3.2
    i have a c++ application which was developed on solaris. now i am
    porting it to AIX.
    most of my modules work fine.
    But when i tried to port one of the module which uses multithreading,
    it gives me segmentation Fault coredump for more than one thread.
    i am using pthread library.
    for one thread it works fine.
    for more than one it coredumps.
    is there anything need to be set on AIX for thread support. or is there
    anything which needs to be put in Makefile?
    please help me to solve this issue.
    thanks in advance.

    regards
    Nagaraj Hayyal

  • Razvan Cojocaru

    #2
    Re: multithreaded c++ program gives segmentation fault coredump

    g++ -pthread -DREENTRANT

    Though -pthread should already define REENTRANT IIRC. Of course, your
    compiler should be compiled with threads support itself. You can check
    this with:

    gcc -dumpspecs | grep -i thread

    or:

    gcc -v

    which should output a line similar to "Thread model: posix"


    --
    Razvan Cojocaru
    KeyID: 1024D/04CA34DE

    Comment

    • nrhayyal

      #3
      Re: multithreaded c++ program gives segmentation fault coredump

      hi,
      thanks for ur reply..
      i didnt get when u said " Of course, your
      compiler should be compiled with threads support itself."

      did u mean that the gcc itself should be compiled with thread support?
      when i checked with gcc -v i found that thread model is aix.
      here is the stuff :
      gcc -v :

      Reading specs from
      /usr/local/gcc-3.3.2/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/specs
      Configured with: ../configure --prefix=/usr/local/gcc-3.3.2
      Thread model: aix
      gcc version 3.3.2

      so if my thread model is aix, cant i use posix threads on it?
      if not can u please help me in setting this thread model to posix.

      thanks again
      nagaraj

      Comment

      Working...