-
- Downloads
After discussion with Giuseppe I have added two improvements that he has
kindly suggested. Firstly the instance() method assumes that destroyInstance() is not called concurrently with it so it can assume that in a multi-threaded scenario there is a single transition from s_instance being NULL to s_instance pointing to a newly created Log object. This means the following mutex-less if statement can be at the beginning of the instance() method to increase performance: if(NULL != s_instance) { return *s_instance; } Secondly the destructor of the Log class should be private in order to prevent clients from being able to directly delete the Log singleton.
Please register or sign in to comment