Make Select a singleton

It's going to manipulate process-global signal state, so multiple
instances do not make sense.
This commit is contained in:
Keegan McAllister
2012-05-04 23:37:07 -04:00
committed by Keith Winstein
parent bb651581a7
commit 768d4ce797
9 changed files with 45 additions and 8 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ termemu_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync
ntester_SOURCES = ntester.cc
ntester_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs $(protobuf_CFLAGS)
ntester_LDADD = ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a -lutil -lm $(protobuf_LIBS)
ntester_LDADD = ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a ../util/libmoshutil.a -lutil -lm $(protobuf_LIBS)
benchmark_SOURCES = benchmark.cc
benchmark_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I../protobufs -I$(srcdir)/../frontend -I$(srcdir)/../crypto -I$(srcdir)/../network $(STDDJB_CPPFLAGS) $(protobuf_CFLAGS)
+2 -2
View File
@@ -58,7 +58,7 @@ int main( int argc, char *argv[] )
fprintf( stderr, "Port bound is %d, key is %s\n", n->port(), n->get_key().c_str() );
if ( server ) {
Select sel;
Select &sel = Select::get_instance();
sel.add_fd( n->fd() );
uint64_t last_num = n->get_remote_state_num();
while ( true ) {
@@ -100,7 +100,7 @@ int main( int argc, char *argv[] )
exit( 1 );
}
Select sel;
Select &sel = Select::get_instance();
sel.add_fd( STDIN_FILENO );
sel.add_fd( n->fd() );
+1 -1
View File
@@ -122,7 +122,7 @@ void emulate_terminal( int fd )
{
Parser::UTF8Parser parser;
Select sel;
Select &sel = Select::get_instance();
sel.add_fd( STDIN_FILENO );
sel.add_fd( fd );
+1 -1
View File
@@ -227,7 +227,7 @@ void emulate_terminal( int fd )
/* open display */
Terminal::Display display( true ); /* use TERM to initialize */
Select sel;
Select &sel = Select::get_instance();
sel.add_fd( STDIN_FILENO );
sel.add_fd( fd );
sel.add_fd( signal_fd );