Overview
Features
Download
Documentation
Community
Add-Ons & Services

Are Date classes thread safe?

Please post support and help requests here.

Are Date classes thread safe?

Postby mchalls » 03 Sep 2012, 16:35

I'm using Dateformatter like this:

Code: Select all
static std::string getTime() {
  Timestamp now;
  return DateTimeFormatter::format(LocalDateTime(DateTime(now)), "%Y-%m-%d %H:%M:%S.%i");
}


Sometimes I get segmentation fault within this function in a multithreaded application, on the return line when std::string is created. I'm suspecting that one of the Poco classes used above is not thread safe, but found no mention of this in the docs. Could you please advice? :-)

I'm using Poco 1.3.6p2 on 64bit SLES11 SP1.
mchalls
 
Posts: 1
Joined: 03 Sep 2012, 16:27

Re: Are Date classes thread safe?

Postby alex » 04 Sep 2012, 04:55

I can't find anything in any of the involved classes that would cause them to be non-reentrant (typically, a static member would do that). But, why make it so complicated when this will achieve the same:
Code: Select all
DateTimeFormatter::format(LocalDateTime(), "%Y-%m-%d %H:%M:%S.%i");

And then, last but not least, the most recent release was 1.4.3, with 1.4.4 being released within a matter of days. Perhaps an upgrade would be a good idea ...
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron