diff options
author | Steve Huston <shuston@riverace.com> | 2002-03-06 23:34:25 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2002-03-06 23:34:25 +0000 |
commit | 79d93a08ebaf5c4b712b5550b11a920d6e37e4c8 (patch) | |
tree | b2f877b21014368afa806a980cfa2e461a3d1c6f /examples | |
parent | ac4997a2d879c90914d5a819afbf517bef674115 (diff) | |
download | ATCD-79d93a08ebaf5c4b712b5550b11a920d6e37e4c8.tar.gz |
ChangeLogTag:Wed Mar 6 18:30:49 2002 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/C++NPv1/Reactive_Logging_Server.h | 9 | ||||
-rw-r--r-- | examples/C++NPv1/Reactive_Logging_Server_Ex.h | 1 | ||||
-rw-r--r-- | examples/C++NPv1/Thread_Per_Connection_Logging_Server.h | 18 |
3 files changed, 25 insertions, 3 deletions
diff --git a/examples/C++NPv1/Reactive_Logging_Server.h b/examples/C++NPv1/Reactive_Logging_Server.h index 0c637b111da..52e7b99a699 100644 --- a/examples/C++NPv1/Reactive_Logging_Server.h +++ b/examples/C++NPv1/Reactive_Logging_Server.h @@ -36,9 +36,9 @@ protected: int width = (int)active_handles_.max_set () + 1; if (select (width, active_handles_.fdset (), - 0, // no write_fds - 0, // no except_fds - 0)) // no timeout + 0, // no write_fds + 0, // no except_fds + 0) == -1) // no timeout return -1; active_handles_.sync ((ACE_HANDLE) ((int)active_handles_.max_set () + 1)); @@ -50,6 +50,9 @@ protected: while (acceptor ().accept (logging_handler ().peer ()) == 0) master_handle_set_.set_bit (logging_handler ().peer ().get_handle ()); + + // Remove acceptor handle from further consideration. + active_handles_.clr_bit (acceptor ().get_handle ()); } return 0; } diff --git a/examples/C++NPv1/Reactive_Logging_Server_Ex.h b/examples/C++NPv1/Reactive_Logging_Server_Ex.h index efcd4e185a0..5a20faee993 100644 --- a/examples/C++NPv1/Reactive_Logging_Server_Ex.h +++ b/examples/C++NPv1/Reactive_Logging_Server_Ex.h @@ -64,6 +64,7 @@ protected: log_map_.bind (logging_peer.get_handle (), log_file); master_handle_set_.set_bit (logging_peer.get_handle ()); } + active_read_handles_.clr_bit (acceptor ().get_handle ()); return 0; } diff --git a/examples/C++NPv1/Thread_Per_Connection_Logging_Server.h b/examples/C++NPv1/Thread_Per_Connection_Logging_Server.h index c9b8393dfb6..886f8091c6d 100644 --- a/examples/C++NPv1/Thread_Per_Connection_Logging_Server.h +++ b/examples/C++NPv1/Thread_Per_Connection_Logging_Server.h @@ -26,6 +26,24 @@ private: protected: virtual int handle_connections (); virtual int handle_data (ACE_SOCK_Stream * = 0); + +public: + // Template Method that runs logging server's event loop. Need to + // reimplement this here because the threads spawned from handle_connections + // call handle_data; therefore, this method must not. + virtual int run (int argc, char *argv[]) { + if (open (argc > 1 ? atoi (argv[1]) : 0) == -1) + return -1; + + for (;;) { + if (wait_for_multiple_events () == -1) + return -1; + if (handle_connections () == -1) + return -1; + } + + return 0; + } }; #endif /* _THREAD_PER_CONNECTION_LOGGING_SERVER_H */ |