Re: Thread safty audit & +initialize ?
Re: Thread safty audit & +initialize ?
- Subject: Re: Thread safty audit & +initialize ?
- From: Brant Vasilieff <email@hidden>
- Date: Wed, 25 Jul 2001 08:26:44 -0700
Any idea what would cause it to get called multiple times for a single
thread? I suppose someone could explicitly call it in their code, but I
was under the impression that it was part of the runtime model and would
only be called once. Unfortunately, I haven't been able to find much
documentation about it.
On Wednesday, July 25, 2001, at 01:45 AM, John C. Randolph wrote:
On Tuesday, July 24, 2001, at 11:10 PM, Brant Vasilieff wrote:
I'm almost done with my threading audit for one application, but I'm
curious. Is it theoretically possible for a class initialization to
get called twice by two threads?
Not only that, it's possible for +initialize to get called multiple
times in a single-threaded app. Whenever I'm creating a shared
instance, I *always* check before creating it.