Thread and gdb stack overflow warning

Help
2014-08-04
2014-08-04
  • FredrikBakke
    FredrikBakke
    2014-08-04

    Hi, i hope to get some clarification of whether my use of boost thread causes a stack overflow.
    I have created a class that uses boost threads, and other classes derived from this thread. just after thread creation GDB will warn me of a possible stack overflow.

    should I take this seriously?

    The thread class looks like this:
    class ThreadClass {
    public:
    ThreadClass();
    virtual ~ThreadClass();
    virtual void start();
    virtual void stop();
    virtual void join();
    virtual void run() = 0;
    private:
    uint8 StopThreadFlag;
    boost::thread Thread;
    };
    ThreadClass::ThreadClass(){
    StopThreadFlag = 0;
    }
    ThreadClass::~ThreadClass(){
    }
    void ThreadClass::start() {
    Thread = boost::thread(&ThreadClass::run, this);
    //run is a pure virtual function that is overloaded by derived classes
    }

    Thread are started like this:

        DerivedClass::Instance()->start();
    

    the functions in use are not overloaded by the derived classes, and the derived classes uses a singleton pattern, and are referenced through the class.

    when i run 'where' (in gdb) after having executed the function above it gives me this info:
    #0 0x44baf008 in ?? () from /.../libc.so.6
    #1 0x44ccd408 in ?? () from /.../libpthread.so.0
    #2 0x44ccd408 in ?? () from /.../libpthread.so.0
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)

    -Regards