Article View: borland.public.cppbuilder.oodesign
Article #119Re: object create order
From: Phil Staite
Date: Thu, 11 Nov 2004 02:55
Date: Thu, 11 Nov 2004 02:55
22 lines
2121 bytes
2121 bytes
Yep, never intended to be thread-safe. Of course, to make it thread safe you'd need some kind of lock to control access. Of course, that lock would have to be created and initialized before anyone tried to use it... Hmm, kind of the same problem the OP was looking at... That kind of thing is best done by the main thread *before* it kicks off any additional threads. "Chris Uzdavinis (TeamB)" <chris@uzdavinis.com> wrote in message > > Yes. Static local variables of functions are not protected, and are > constructed the first invocation. If two threads both call the same > function at the same time, then the single static member could be > constructed multiple times. If that's not bad enough, at program > shutdown, it could get multiply destroyed, depending on how that gets > setup, which may (should) crash your program. > > -- > Chris (TeamB);
Technical Details
Message-ID:
<4192e1c3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!border1.nntp.dca.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<kcdqo0t2f0vkit49u0l9goji42stukiq17@4ax.com> <418ed304$1@newsgroups.borland.com> <g2uto0p62cvgkccrnnd13dke6vf19d9m94@4ax.com> <adu3p0ha0a5ur21ssd817c6ugqegigee72@4ax.com> <cgs4p0pdn91rqd3f9gq16po2481g2dqm86@4ax.com> <r6t4p09hq6msmtm862t76ohmk6et7fg6di@4ax.com> <j5zn1pqq9i.fsf@explicit.atdesk.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,7fd39362bd6d0fe2 X-Google-Attributes: gid10db1e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Phil Staite" <no.spam@not.a.chance> Newsgroups: borland.public.cppbuilder.oodesign References: <kcdqo0t2f0vkit49u0l9goji42stukiq17@4ax.com> <418ed304$1@newsgroups.borland.com> <g2uto0p62cvgkccrnnd13dke6vf19d9m94@4ax.com> <adu3p0ha0a5ur21ssd817c6ugqegigee72@4ax.com> <cgs4p0pdn91rqd3f9gq16po2481g2dqm86@4ax.com> <r6t4p09hq6msmtm862t76ohmk6et7fg6di@4ax.com> <j5zn1pqq9i.fsf@explicit.atdesk.com> Subject: Re: object create order Date: Wed, 10 Nov 2004 20:55:32 -0600 Lines: 24 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 206.53.29.93 Message-ID: <4192e1c3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100145091 206.53.29.93 (10 Nov 2004 19:51:31 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!border1.nntp.dca.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail