Use static local variable for consistency with compressor, dispatch table

This commit is contained in:
Keith Winstein
2012-05-16 00:17:37 -04:00
parent dd941df19d
commit a4dd2fed89
2 changed files with 3 additions and 9 deletions
-2
View File
@@ -18,8 +18,6 @@
#include "select.h" #include "select.h"
Select *Select::instance = NULL;
fd_set Select::dummy_fd_set; fd_set Select::dummy_fd_set;
sigset_t Select::dummy_sigset; sigset_t Select::dummy_sigset;
+3 -7
View File
@@ -34,16 +34,12 @@
class Select { class Select {
public: public:
static Select &get_instance( void ) { static Select &get_instance( void ) {
// NB: not thread-safe /* COFU may or may not be thread-safe, depending on compiler */
if ( !instance ) { static Select instance;
instance = new Select; return instance;
}
return *instance;
} }
private: private:
static Select *instance;
Select() Select()
: max_fd( -1 ) : max_fd( -1 )
, got_any_signal( 0 ) , got_any_signal( 0 )