a template and thread safe singleton base class.