Re: [devel] [PATCH 1/1] base: Place TraceLog instance on heap memory V3 [#2860]

2018-05-27 Thread Hans Nordeback
Hi Minh, yes, std::call_once or pthread_once should work. /Thanks HansN On 05/28/2018 05:08 AM, Minh Hon Chau wrote: Hi Hans, I think it can happen e.g if the traces in agent are enabled for more than 1 services. Maybe std::call_once can do? Thanks Minh On 25/05/18 18:33, Hans Nordeback w

Re: [devel] [PATCH 1/1] base: Place TraceLog instance on heap memory V3 [#2860]

2018-05-27 Thread Minh Hon Chau
Hi Hans, I think it can happen e.g if the traces in agent are enabled for more than 1 services. Maybe std::call_once can do? Thanks Minh On 25/05/18 18:33, Hans Nordeback wrote: Hi Minh, ack, with a comment/question, if logtrace_init can be called concurrently, the new calls are not thread

Re: [devel] [PATCH 1/1] base: Place TraceLog instance on heap memory V3 [#2860]

2018-05-25 Thread Hans Nordeback
Hi Minh, ack, with a comment/question, if logtrace_init can be called concurrently, the new calls are not thread safe. If so, (it is the same problem when e.g. making a singleton thread safe, where e.g. "double-checked locking" has been tried, but does not work). Using pthread_once here sh

[devel] [PATCH 1/1] base: Place TraceLog instance on heap memory V3 [#2860]

2018-05-24 Thread Minh Chau
When a process calls exit(), the exit_handler trigger __do_global_dtor_aux then calls TraceLog destructor. One of process thread is calling TraceLog::Log while the destructor is called. This leads to a coredump. The process (which could by any applications) calling exit() first is responsible to ma