std::string, std::ostringstream behaves unpredictably in multithreaded environment.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm using pthreads on Fedora Core 1.

I have compiled my entire project with

-D_REENTRANT 
-D_MULTI_THREADED

I get Segmentation faults for naive code that uses std::string's
operator+, std::ostringstream's operator<< as a local variable in stack.

std::string Formatter::format(const LogRecord& record) const
{
    std::ostringstream ost;
    ost << record.getTime() << "  " << record.getMessage(); //<--Crashes
    return ost.str();
}

Do i have to do anything extra in order for my program to behave
predictably in multi-threaded environment?

Regards,
L.Suresh.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux