title: Singleton & Multi-threading
body: <p>I have the following class   </p>
  
  <pre><code>class Singleton
  {
    private:
  
      static Singleton *p_inst;
      Singleton();
  
    public:
  
      static Singleton * instance()
      {
        if (!p_inst)
        {
          p_inst = new Singleton();
        }
  
        return p_inst;
      }
  };
  </code></pre>
  
  <p>Please do elaborate on precautions taken while implementing Singleton in multi-threaded environment .</p>