[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libcvd-members] gvars3 configure gvars...

From: Edward Rosten
Subject: Re: [libcvd-members] gvars3 configure gvars...
Date: Wed, 20 Feb 2008 16:13:12 -0700 (MST)

On Wed, 20 Feb 2008, Georg Klein wrote:
foo& foo::getinstance()
  static foo f;
  return f;

but the page where I read about this said something along the lines of ``use only when single-threaded.'' Why might that be?

Race conditions on instantiation?

eg in:

  inst = new fooclass();

return inst

the first two lines aren't atomic.

If it's being used for global constructors, then you don't have to worry about threads unless you do something really awesome like pthread_create in a global constructer so you get threads before main starts...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]