public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* std::string, std::ostringstream behaves unpredictably in multithreaded environment.
@ 2004-08-26 14:22 L.Suresh
  0 siblings, 0 replies; only message in thread
From: L.Suresh @ 2004-08-26 14:22 UTC (permalink / raw)
  To: gcc-help; +Cc: michal017

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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-08-26 12:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-26 14:22 std::string, std::ostringstream behaves unpredictably in multithreaded environment L.Suresh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).