楼主: 
kingofsdtw (ä¸èƒ½é–’下來!!)   
2019-04-06 12:44:25开发平台(Platform): (Ex: Win10, Linux, ...) 
gun c
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
额外使用到的函数库(Library Used): (Ex: OpenGL, ...) 
问题(Question):
HPe 面试题
有个class 叫foo是 single instance
Instance为NULL
如果有两个thread "同时" Get singleInstance 该怎解决这问题?
喂入的资料(Input):
同一时间init foo class
thread1:  pfool = foo::getInstance();
thread2:  pfool = foo::getInstance();
class foo{
  public:
  static foo *getInstance(){
    if( instance == null )
        instance = new foo();
    return instance;
   }
 private:
   foo(){
   }
   static foo* instance;
   std::mutex mutex;
}
预期的正确结果(Expected Output):
只会有一个pf位址
错误结果(Wrong Output):
程式码(Code):(请善用置底文网页, 记得排版,禁止使用图档) 
补充说明(Supplement):
我记得曾经看过一篇文章getInstance  mutex还未初始化所以不能用