RE: Question about static class objects

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 27 May 2008 13:23:43 -0500


Hi Konstantin,

Well, yes ... however the issue presented by Tom was:

You are correct that using static member is not thread safe. However, using a function static is still better than using a class static.

In addition, since this is for interpreted code and that the interpreter is currently not thread safe, there is really no (new) thread issue :)

Cheers,
Philippe.

-----Original Message-----
From: Konstantin Olchanski [mailto:olchansk_at_triumf.ca] Sent: Tuesday, May 27, 2008 1:15 PM
To: Philippe Canal
Cc: 'Tom Roberts'; 'ROOT Talk'
Subject: Re: [ROOT] Question about static class objects

On Tue, May 27, 2008 at 12:01:57PM -0500, Philippe Canal wrote:
> TList &Zap::list() {
> static TList list;
> return list;
> }
> which anyway is slightly better in term of C++ style :)

This will bomb in a multi-threaded program?

-- 
Konstantin Olchanski
Data Acquisition Systems: The Bytes Must Flow!
Email: olchansk-at-triumf-dot-ca
Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, Canada
Received on Tue May 27 2008 - 20:23:49 CEST

This archive was generated by hypermail 2.2.0 : Tue May 27 2008 - 23:50:01 CEST