fix use of ACE with gcc-3.*
[email protected] Fri, 30 Jan 2004 11:23:40 -0800
| Newsgroups | gmane.comp.lib.ivtools.patches |
|---|---|
| Message-ID | <[email protected]> |
Patch: ivtools-040130-johnston-006 For: ivtools-1.1.2 Author: [email protected] Subject: fix use of ACE with gcc-3.* Requires: This is an intermediate patch to ivtools-1.1.2. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - fix ivtools use of ACE when compiled with gcc-3.*. All calls to the instance() method on the Reactor singleton had to be isolated into a single module to guarantee that it really was a singleton. For more details see my comp.soft-sys.ace newsgroup posting on Jan 30 2004 (as [email protected]). - first draft at fixing the comterp remote func, which doesn't use a ComterpHandler. Index: comdraw/main.c diff -c comdraw/main.c:1.1 comdraw/main.c:1.2 *** comdraw/main.c:1.1 Fri Jan 9 11:45:03 2004 --- src/comdraw/main.c Fri Jan 30 11:12:48 2004 *************** *** 246,252 **** int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(IMPORT_REACTOR::instance())); #endif OverlayCreator creator; OverlayCatalog* catalog = new OverlayCatalog("comdraw", &creator); --- 246,252 ---- int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton())); #endif OverlayCreator creator; OverlayCatalog* catalog = new OverlayCatalog("comdraw", &creator); *************** *** 266,275 **** const char* importstr = catalog->GetAttribute("import"); int importnum = atoi(importstr); if (import_acceptor->open ! (ACE_INET_Addr (importnum)) == -1) cerr << "comdraw: unable to open import port " << importnum << "\n"; ! else if (COMTERP_REACTOR::instance ()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "comdraw: unable to register UnidrawImportAcceptor with ACE reactor\n"; else --- 266,275 ---- const char* importstr = catalog->GetAttribute("import"); int importnum = atoi(importstr); if (import_acceptor->open ! (ACE_INET_Addr (importnum), ComterpHandler::reactor_singleton()) == -1) cerr << "comdraw: unable to open import port " << importnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "comdraw: unable to register UnidrawImportAcceptor with ACE reactor\n"; else *************** *** 282,291 **** const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum)) == -1) cerr << "comdraw: unable to open port " << portnum << "\n"; ! else if (COMTERP_REACTOR::instance ()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "comdraw: unable to register ComterpAcceptor with ACE reactor\n"; else --- 282,291 ---- const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum), ComterpHandler::reactor_singleton()) == -1) cerr << "comdraw: unable to open port " << portnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "comdraw: unable to register ComterpAcceptor with ACE reactor\n"; else *************** *** 295,301 **** // Register COMTERP_QUIT_HANDLER to receive SIGINT commands. When received, // COMTERP_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (COMTERP_REACTOR::instance ()->register_handler (SIGINT, COMTERP_QUIT_HANDLER::instance ()) == -1) cerr << "comdraw: unable to register quit handler with ACE reactor\n"; --- 295,301 ---- // Register COMTERP_QUIT_HANDLER to receive SIGINT commands. When received, // COMTERP_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (ComterpHandler::reactor_singleton()->register_handler (SIGINT, COMTERP_QUIT_HANDLER::instance ()) == -1) cerr << "comdraw: unable to register quit handler with ACE reactor\n"; *************** *** 319,327 **** if (!stdin_off_str || strcmp(stdin_off_str, "false")==0) { UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, COMTERP_REACTOR::instance(), nil) == -1) #else ! if (COMTERP_REACTOR::instance()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "comdraw: unable to open stdin with ACE\n"; --- 319,327 ---- if (!stdin_off_str || strcmp(stdin_off_str, "false")==0) { UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, ComterpHandler::reactor_singleton(), nil) == -1) #else ! if (ComterpHandler::reactor_singleton()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "comdraw: unable to open stdin with ACE\n"; Index: ComTerp/comhandler.c diff -c ComTerp/comhandler.c:1.1 ComTerp/comhandler.c:1.2 *** ComTerp/comhandler.c:1.1 Fri Jan 9 11:42:25 2004 --- src/ComTerp/comhandler.c Fri Jan 30 11:12:29 2004 *************** *** 45,51 **** // Default constructor. ! ComterpHandler::ComterpHandler (void) { comterp_ = new ComTerpServ(BUFSIZ*BUFSIZ); comterp_->handler(this); --- 45,54 ---- // Default constructor. ! ComterpHandler::ComterpHandler (void) ! #if 0 ! : ACE_Svc_Handler<ACE_SOCK_Stream, ACE_NULL_SYNCH>(0,0,ComterpHandler::reactor_singleton()) ! #endif { comterp_ = new ComTerpServ(BUFSIZ*BUFSIZ); comterp_->handler(this); *************** *** 67,77 **** int ComterpHandler::timeoutscriptid() { return _timeoutscriptid; } void ComterpHandler::timeoutscriptid(int timeoutscriptid) { if (_timeoutscriptid != -1) ! COMTERP_REACTOR::instance ()->cancel_timer (this); _timeoutscriptid = timeoutscriptid; if (_timeoutscriptid != -1) { ! if (COMTERP_REACTOR::instance ()->schedule_timer (this, (const void *) this, ACE_Time_Value (timeoutseconds()), --- 70,80 ---- int ComterpHandler::timeoutscriptid() { return _timeoutscriptid; } void ComterpHandler::timeoutscriptid(int timeoutscriptid) { if (_timeoutscriptid != -1) ! ComterpHandler::reactor_singleton()->cancel_timer (this); _timeoutscriptid = timeoutscriptid; if (_timeoutscriptid != -1) { ! if (ComterpHandler::reactor_singleton()->schedule_timer (this, (const void *) this, ACE_Time_Value (timeoutseconds()), *************** *** 88,94 **** ACE_DEBUG ((LM_DEBUG, "(%P|%t) disconnected from %s\n", this->peer_name_)); #if 0 ! COMTERP_REACTOR::instance ()->cancel_timer (this); #endif this->peer ().close (); if (_timeoutscriptid<0) --- 91,97 ---- ACE_DEBUG ((LM_DEBUG, "(%P|%t) disconnected from %s\n", this->peer_name_)); #if 0 ! ComterpHandler::reactor_singleton()->cancel_timer (this); #endif this->peer ().close (); if (_timeoutscriptid<0) *************** *** 246,257 **** ACE_OS::strncpy (this->peer_name_, buffer, MAXHOSTNAMELEN + 1); ! if (COMTERP_REACTOR::instance ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); #if defined(__NetBSD__) /* this seems to be required for NetBSD */ ! else if (COMTERP_REACTOR::instance ()->schedule_timer (this, (const void *) this, ACE_Time_Value (10), --- 249,260 ---- ACE_OS::strncpy (this->peer_name_, buffer, MAXHOSTNAMELEN + 1); ! if (ComterpHandler::reactor_singleton()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); #if defined(__NetBSD__) /* this seems to be required for NetBSD */ ! else if (ComterpHandler::reactor_singleton()->schedule_timer (this, (const void *) this, ACE_Time_Value (10), *************** *** 275,280 **** --- 278,291 ---- { this->destroy (); return 0; + } + + // Our Reactor Singleton. + typedef ACE_Singleton<ACE_Reactor, ACE_Null_Mutex> + REACTOR; + + ACE_Reactor* ComterpHandler::reactor_singleton() { + return REACTOR::instance(); } #endif /* HAVE_ACE */ Index: ComTerp/comhandler.h diff -c ComTerp/comhandler.h:1.1 ComTerp/comhandler.h:1.2 *** ComTerp/comhandler.h:1.1 Fri Jan 9 11:42:25 2004 --- src/ComTerp/comhandler.h Fri Jan 30 11:12:29 2004 *************** *** 40,48 **** --- 40,53 ---- #include <ace/Singleton.h> #include <ace/Svc_Handler.h> #include <ace/SOCK_Acceptor.h> + #include <ace/Test_and_Set.h> class ComTerpServ; + //: An ACE_Test_and_Set Singleton. + typedef ACE_Singleton<ACE_Test_and_Set <ACE_Null_Mutex, sig_atomic_t>, ACE_Null_Mutex> + COMTERP_QUIT_HANDLER; + //: handler to invoke ComTerp on socket (version with ACE) class ComterpHandler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> { *************** *** 91,96 **** --- 96,104 ---- FILE* rdfptr() { return _rdfptr; } // file pointer for reading from handle + static ACE_Reactor* reactor_singleton(); + // alternate way of getting at reactor singleton + protected: // = Demultiplexing hooks. virtual int handle_input (ACE_HANDLE); *************** *** 119,133 **** static int _logger_mode; // mode for logging commands: 0 = no log, 1 = log only - }; ! //: A Reactor Singleton. ! typedef ACE_Singleton<ACE_Reactor, ACE_Null_Mutex> ! COMTERP_REACTOR; ! ! //: An ACE_Test_and_Set Singleton. ! typedef ACE_Singleton<ACE_Test_and_Set <ACE_Null_Mutex, sig_atomic_t>, ACE_Null_Mutex> ! COMTERP_QUIT_HANDLER; //: Specialize a ComterpAcceptor. typedef ACE_Acceptor <ComterpHandler, ACE_SOCK_ACCEPTOR> --- 127,134 ---- static int _logger_mode; // mode for logging commands: 0 = no log, 1 = log only ! }; //: Specialize a ComterpAcceptor. typedef ACE_Acceptor <ComterpHandler, ACE_SOCK_ACCEPTOR> *************** *** 156,161 **** --- 157,163 ---- protected: int _handle; ComTerpServ* comterp_; + }; #endif Index: ComTerp/ctrlfunc.c diff -c ComTerp/ctrlfunc.c:1.1 ComTerp/ctrlfunc.c:1.2 *** ComTerp/ctrlfunc.c:1.1 Fri Jan 9 11:42:26 2004 --- src/ComTerp/ctrlfunc.c Fri Jan 30 11:12:29 2004 *************** *** 134,147 **** filebuf ofbuf; ofbuf.attach(socket.get_handle()); #else ! fileptr_filebuf ofbuf(comterp()->handler() && comterp()->handler()->wrfptr() ! ? comterp()->handler()->wrfptr() : stdout, ios_base::out); #endif ostream out(&ofbuf); const char* cmdstr = cmdstrv.string_ptr(); out << cmdstr; if (cmdstr[strlen(cmdstr)-1] != '\n') out << "\n"; out.flush(); if (nowaitv.is_false()) { #if __GNUC__<3 filebuf ifbuf; --- 134,150 ---- filebuf ofbuf; ofbuf.attach(socket.get_handle()); #else ! FILE* ofptr = fdopen(socket.get_handle(), "r"); ! fileptr_filebuf ofbuf(ofptr, ios_base::out); #endif ostream out(&ofbuf); const char* cmdstr = cmdstrv.string_ptr(); out << cmdstr; if (cmdstr[strlen(cmdstr)-1] != '\n') out << "\n"; out.flush(); + #if __GNUC__>=3 + fclose(ofptr); + #endif if (nowaitv.is_false()) { #if __GNUC__<3 filebuf ifbuf; *************** *** 150,156 **** char* buf; in.gets(&buf); #else ! fileptr_filebuf ifbuf(comterp()->handler()->rdfptr(), ios_base::in); istream in(&ifbuf); char buf[BUFSIZ]; in.get(buf, BUFSIZ); --- 153,160 ---- char* buf; in.gets(&buf); #else ! FILE* fptr = fdopen(socket.get_handle(), "r"); ! fileptr_filebuf ifbuf(fptr, ios_base::in); istream in(&ifbuf); char buf[BUFSIZ]; in.get(buf, BUFSIZ); *************** *** 158,163 **** --- 162,170 ---- #endif ComValue& retval = comterpserv()->run(buf, true); push_stack(retval); + #if __GNUC__>=3 + fclose(fptr); + #endif } if (socket.close () == -1) Index: comterp_/Imakefile diff -c comterp_/Imakefile:1.1 comterp_/Imakefile:1.2 *** comterp_/Imakefile:1.1 Fri Jan 9 11:42:31 2004 --- src/comterp_/Imakefile Fri Jan 30 11:12:31 2004 *************** *** 16,22 **** ComplexProgramTarget(comterp) - #define Obj(file) MakeObjectFromSrcFlags(file, -D__ACE_INLINE__) Obj(main) --- 16,21 ---- Index: comterp_/main.c diff -c comterp_/main.c:1.1 comterp_/main.c:1.2 *** comterp_/main.c:1.1 Fri Jan 9 11:42:31 2004 --- src/comterp_/main.c Fri Jan 30 11:12:31 2004 *************** *** 71,85 **** #ifdef HAVE_ACE if (server_flag || logger_flag) { ! ComterpAcceptor* peer_acceptor = new ComterpAcceptor(); ComterpHandler::logger_mode(logger_flag); int portnum = argc > 2 ? atoi(argv[2]) : atoi(ACE_DEFAULT_SERVER_PORT_STR); ! if (peer_acceptor->open (ACE_INET_Addr (portnum)) == -1) cerr << "comterp: unable to open port " << portnum << " with ACE\n"; #if !defined(__NetBSD__) /* this is not the way to do it for NetBSD */ ! else if (COMTERP_REACTOR::instance ()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "comterp: error registering acceptor with ACE reactor\n"; #endif --- 71,87 ---- #ifdef HAVE_ACE if (server_flag || logger_flag) { ! ComterpAcceptor* peer_acceptor = ! new ComterpAcceptor(ComterpHandler::reactor_singleton()); ComterpHandler::logger_mode(logger_flag); int portnum = argc > 2 ? atoi(argv[2]) : atoi(ACE_DEFAULT_SERVER_PORT_STR); ! if (peer_acceptor->open (ACE_INET_Addr (portnum), ! ComterpHandler::reactor_singleton()) == -1) cerr << "comterp: unable to open port " << portnum << " with ACE\n"; #if !defined(__NetBSD__) /* this is not the way to do it for NetBSD */ ! else if (ComterpHandler::reactor_singleton()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "comterp: error registering acceptor with ACE reactor\n"; #endif *************** *** 90,96 **** // Register COMTERP_QUIT_HANDLER to receive SIGINT commands. When received, // COMTERP_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (COMTERP_REACTOR::instance ()->register_handler (SIGINT, COMTERP_QUIT_HANDLER::instance ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1); --- 92,98 ---- // Register COMTERP_QUIT_HANDLER to receive SIGINT commands. When received, // COMTERP_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (ComterpHandler::reactor_singleton()->register_handler (SIGINT, COMTERP_QUIT_HANDLER::instance ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1); *************** *** 98,111 **** // Start up one on stdin if (!logger_flag) { ComterpHandler* stdin_handler = new ComterpHandler(); ! if (COMTERP_REACTOR::instance()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) cerr << "comterp: unable to open stdin with ACE\n"; } // Perform logging service until COMTERP_QUIT_HANDLER receives SIGINT. while (COMTERP_QUIT_HANDLER::instance ()->is_set () == 0) ! COMTERP_REACTOR::instance ()->handle_events (); return 0; } --- 100,113 ---- // Start up one on stdin if (!logger_flag) { ComterpHandler* stdin_handler = new ComterpHandler(); ! if (ComterpHandler::reactor_singleton()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) cerr << "comterp: unable to open stdin with ACE\n"; } // Perform logging service until COMTERP_QUIT_HANDLER receives SIGINT. while (COMTERP_QUIT_HANDLER::instance ()->is_set () == 0) ! ComterpHandler::reactor_singleton()->handle_events (); return 0; } Index: drawserv_/main.c diff -c drawserv_/main.c:1.1 drawserv_/main.c:1.2 *** drawserv_/main.c:1.1 Fri Jan 9 11:45:20 2004 --- src/drawserv_/main.c Fri Jan 30 11:12:57 2004 *************** *** 30,35 **** --- 30,36 ---- #include <ComUnidraw/comterp-acehandler.h> #include <OverlayUnidraw/aceimport.h> #include <AceDispatch/ace_dispatcher.h> + #include <Comterp/comhandler.h> #endif #include <DrawServ/drawcatalog.h> *************** *** 208,214 **** int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(IMPORT_REACTOR::instance())); #endif DrawCreator creator; DrawCatalog* catalog = new DrawCatalog("ivtools drawserv", &creator); --- 209,215 ---- int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton())); #endif DrawCreator creator; DrawCatalog* catalog = new DrawCatalog("ivtools drawserv", &creator); *************** *** 226,232 **** (ACE_INET_Addr (importnum)) == -1) cerr << "drawserv: unable to open import port " << importnum << "\n"; ! else if (COMTERP_REACTOR::instance ()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "drawserv: unable to register UnidrawImportAcceptor with ACE reactor\n"; else --- 227,233 ---- (ACE_INET_Addr (importnum)) == -1) cerr << "drawserv: unable to open import port " << importnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "drawserv: unable to register UnidrawImportAcceptor with ACE reactor\n"; else *************** *** 239,248 **** const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum)) == -1) cerr << "drawserv: unable to open port " << portnum << "\n"; ! else if (COMTERP_REACTOR::instance ()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "drawserv: unable to register ComterpAcceptor with ACE reactor\n"; else --- 240,249 ---- const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum), ComterpHandler::reactor_singleton()) == -1) cerr << "drawserv: unable to open port " << portnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "drawserv: unable to register ComterpAcceptor with ACE reactor\n"; else *************** *** 252,258 **** // Register COMTERP_QUIT_HANDLER to receive SIGINT commands. When received, // COMTERP_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (COMTERP_REACTOR::instance ()->register_handler (SIGINT, COMTERP_QUIT_HANDLER::instance ()) == -1) cerr << "drawserv: unable to register quit handler with ACE reactor\n"; --- 253,259 ---- // Register COMTERP_QUIT_HANDLER to receive SIGINT commands. When received, // COMTERP_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (ComterpHandler::reactor_singleton()->register_handler (SIGINT, COMTERP_QUIT_HANDLER::instance ()) == -1) cerr << "drawserv: unable to register quit handler with ACE reactor\n"; *************** *** 283,291 **** /* Start up one on stdin */ UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, COMTERP_REACTOR::instance(), nil) == -1) #else ! if (COMTERP_REACTOR::instance()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "drawserv: unable to open stdin with ACE\n"; --- 284,292 ---- /* Start up one on stdin */ UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, ComterpHandler::reactor_singleton(), nil) == -1) #else ! if (ComterpHandler::reactor_singleton()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "drawserv: unable to open stdin with ACE\n"; Index: drawtool/main.c diff -c drawtool/main.c:1.1 drawtool/main.c:1.2 *** drawtool/main.c:1.1 Fri Jan 9 11:44:57 2004 --- src/drawtool/main.c Fri Jan 30 11:12:46 2004 *************** *** 32,37 **** --- 32,38 ---- #ifdef HAVE_ACE #include <OverlayUnidraw/aceimport.h> #include <AceDispatch/ace_dispatcher.h> + #include <Comterp/comhandler.h> #endif #include <OverlayUnidraw/ovcatalog.h> *************** *** 224,230 **** int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(IMPORT_REACTOR::instance())); #endif int exit_status = 0; OverlayCreator creator; --- 225,231 ---- int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton())); #endif int exit_status = 0; OverlayCreator creator; *************** *** 248,254 **** (ACE_INET_Addr (importnum)) == -1) cerr << "drawtool: unable to open import port " << importnum << "\n"; ! else if (IMPORT_REACTOR::instance ()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "drawtool: unable to register UnidrawImportAcceptor with ACE reactor\n"; --- 249,255 ---- (ACE_INET_Addr (importnum)) == -1) cerr << "drawtool: unable to open import port " << importnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "drawtool: unable to register UnidrawImportAcceptor with ACE reactor\n"; *************** *** 258,264 **** // Register IMPORT_QUIT_HANDLER to receive SIGINT commands. When received, // IMPORT_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (IMPORT_REACTOR::instance ()->register_handler (SIGINT, IMPORT_QUIT_HANDLER::instance ()) == -1) cerr << "drawtool: unable to register quit handler with ACE reactor\n"; --- 259,265 ---- // Register IMPORT_QUIT_HANDLER to receive SIGINT commands. When received, // IMPORT_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (ComterpHandler::reactor_singleton()->register_handler (SIGINT, IMPORT_QUIT_HANDLER::instance ()) == -1) cerr << "drawtool: unable to register quit handler with ACE reactor\n"; Index: flipbook/main.c diff -c flipbook/main.c:1.1 flipbook/main.c:1.2 *** flipbook/main.c:1.1 Fri Jan 9 11:45:09 2004 --- src/flipbook/main.c Fri Jan 30 11:12:52 2004 *************** *** 232,238 **** int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(IMPORT_REACTOR::instance())); #endif int exit_status = 0; FrameCreator creator; --- 232,238 ---- int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton())); #endif int exit_status = 0; FrameCreator creator; *************** *** 255,261 **** (ACE_INET_Addr (importnum)) == -1) cerr << "flipbook: unable to open import port " << importnum << "\n"; ! else if (IMPORT_REACTOR::instance ()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "flipbook: unable to register UnidrawImportAcceptor with ACE reactor\n"; --- 255,261 ---- (ACE_INET_Addr (importnum)) == -1) cerr << "flipbook: unable to open import port " << importnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "flipbook: unable to register UnidrawImportAcceptor with ACE reactor\n"; *************** *** 268,277 **** const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum)) == -1) cerr << "flipbook: unable to open port " << portnum << "\n"; ! else if (COMTERP_REACTOR::instance ()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "flipbook: unable to register ComterpAcceptor with ACE reactor\n"; else --- 268,277 ---- const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum), ComterpHandler::reactor_singleton()) == -1) cerr << "flipbook: unable to open port " << portnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "flipbook: unable to register ComterpAcceptor with ACE reactor\n"; else *************** *** 281,287 **** // Register IMPORT_QUIT_HANDLER to receive SIGINT commands. When received, // IMPORT_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (IMPORT_REACTOR::instance ()->register_handler (SIGINT, IMPORT_QUIT_HANDLER::instance ()) == -1) cerr << "flipbook: unable to register quit handler with ACE reactor\n"; --- 281,287 ---- // Register IMPORT_QUIT_HANDLER to receive SIGINT commands. When received, // IMPORT_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (ComterpHandler::reactor_singleton()->register_handler (SIGINT, IMPORT_QUIT_HANDLER::instance ()) == -1) cerr << "flipbook: unable to register quit handler with ACE reactor\n"; *************** *** 300,308 **** /* Start up one on stdin */ UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, COMTERP_REACTOR::instance(), nil) == -1) #else ! if (COMTERP_REACTOR::instance()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "flipbook: unable to open stdin with ACE\n"; --- 300,308 ---- /* Start up one on stdin */ UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, ComterpHandler::reactor_singleton(), nil) == -1) #else ! if (ComterpHandler::reactor_singleton()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "flipbook: unable to open stdin with ACE\n"; Index: graphdraw/main.c diff -c graphdraw/main.c:1.1 graphdraw/main.c:1.2 *** graphdraw/main.c:1.1 Fri Jan 9 11:45:15 2004 --- src/graphdraw/main.c Fri Jan 30 11:12:55 2004 *************** *** 215,221 **** int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(IMPORT_REACTOR::instance())); #endif int exit_status = 0; GraphCreator creator; --- 215,221 ---- int main (int argc, char** argv) { #ifdef HAVE_ACE ! Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton())); #endif int exit_status = 0; GraphCreator creator; *************** *** 239,245 **** (ACE_INET_Addr (importnum)) == -1) cerr << "flipbook: unable to open import port " << importnum << "\n"; ! else if (IMPORT_REACTOR::instance ()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "graphdraw: unable to register UnidrawImportAcceptor with ACE reactor\n"; --- 239,245 ---- (ACE_INET_Addr (importnum)) == -1) cerr << "flipbook: unable to open import port " << importnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (import_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "graphdraw: unable to register UnidrawImportAcceptor with ACE reactor\n"; *************** *** 252,261 **** const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum)) == -1) cerr << "graphdraw: unable to open port " << portnum << "\n"; ! else if (COMTERP_REACTOR::instance ()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "graphdraw: unable to register ComterpAcceptor with ACE reactor\n"; else --- 252,261 ---- const char* portstr = catalog->GetAttribute("comdraw"); int portnum = atoi(portstr); if (peer_acceptor->open ! (ACE_INET_Addr (portnum), ComterpHandler::reactor_singleton()) == -1) cerr << "graphdraw: unable to open port " << portnum << "\n"; ! else if (ComterpHandler::reactor_singleton()->register_handler (peer_acceptor, ACE_Event_Handler::READ_MASK) == -1) cerr << "graphdraw: unable to register ComterpAcceptor with ACE reactor\n"; else *************** *** 265,271 **** // Register IMPORT_QUIT_HANDLER to receive SIGINT commands. When received, // IMPORT_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (IMPORT_REACTOR::instance ()->register_handler (SIGINT, IMPORT_QUIT_HANDLER::instance ()) == -1) cerr << "graphdraw: unable to register quit handler with ACE reactor\n"; --- 265,271 ---- // Register IMPORT_QUIT_HANDLER to receive SIGINT commands. When received, // IMPORT_QUIT_HANDLER becomes "set" and thus, the event loop below will // exit. ! if (ComterpHandler::reactor_singleton()->register_handler (SIGINT, IMPORT_QUIT_HANDLER::instance ()) == -1) cerr << "graphdraw: unable to register quit handler with ACE reactor\n"; *************** *** 280,288 **** /* Start up one on stdin */ UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, COMTERP_REACTOR::instance(), nil) == -1) #else ! if (COMTERP_REACTOR::instance()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "graphdraw: unable to open stdin with ACE\n"; --- 280,288 ---- /* Start up one on stdin */ UnidrawComterpHandler* stdin_handler = new UnidrawComterpHandler(); #if 0 ! if (ACE::register_stdin_handler(stdin_handler, ComterpHandler::reactor_singleton(), nil) == -1) #else ! if (ComterpHandler::reactor_singleton()->register_handler(0, stdin_handler, ACE_Event_Handler::READ_MASK)==-1) #endif cerr << "graphdraw: unable to open stdin with ACE\n"; Index: OverlayUnidraw/aceimport.c diff -c OverlayUnidraw/aceimport.c:1.1 OverlayUnidraw/aceimport.c:1.2 *** OverlayUnidraw/aceimport.c:1.1 Fri Jan 9 11:44:52 2004 --- src/OverlayUnidraw/aceimport.c Fri Jan 30 11:12:43 2004 *************** *** 31,36 **** --- 31,37 ---- #include <IVGlyph/importchooser.h> #include <Unidraw/iterator.h> #include <Unidraw/unidraw.h> + #include <Comterp/comhandler.h> #include <fstream.h> #include <stdio.h> *************** *** 54,60 **** { cerr << this->peer_name_ << " disconnected from import port\n"; #if 0 ! IMPORT_REACTOR::instance ()->cancel_timer (this); #endif this->peer ().close (); if (_infptr) { --- 55,61 ---- { cerr << this->peer_name_ << " disconnected from import port\n"; #if 0 ! ComterpHandler::reactor_singleton()->cancel_timer (this); #endif this->peer ().close (); if (_infptr) { *************** *** 121,132 **** addr.get_host_name (), MAXHOSTNAMELEN + 1); ! if (IMPORT_REACTOR::instance ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); #if 0 ! else if (IMPORT_REACTOR::instance ()->schedule_timer (this, (const void *) this, ACE_Time_Value (10), --- 122,133 ---- addr.get_host_name (), MAXHOSTNAMELEN + 1); ! if (ComterpHandler::reactor_singleton()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); #if 0 ! else if (ComterpHandler::reactor_singleton()->schedule_timer (this, (const void *) this, ACE_Time_Value (10), Index: OverlayUnidraw/aceimport.h diff -c OverlayUnidraw/aceimport.h:1.1 OverlayUnidraw/aceimport.h:1.2 *** OverlayUnidraw/aceimport.h:1.1 Fri Jan 9 11:44:52 2004 --- src/OverlayUnidraw/aceimport.h Fri Jan 30 11:12:43 2004 *************** *** 33,38 **** --- 33,39 ---- #include <ace/Singleton.h> #include <ace/Svc_Handler.h> #include <ace/SOCK_Acceptor.h> + #include <ace/Test_and_Set.h> class OvImportCmd; #include <fstream.h> *************** *** 72,81 **** istream* _inptr; // associated input stream FILE* _infptr; // associated FILE* }; - - //: a Reactor Singleton. - typedef ACE_Singleton<ACE_Reactor, ACE_Null_Mutex> - IMPORT_REACTOR; //: an ACE_Test_and_Set Singleton for Ctrl-C. typedef ACE_Singleton<ACE_Test_and_Set <ACE_Null_Mutex, sig_atomic_t>, ACE_Null_Mutex> --- 73,78 ---- *** /dev/null Fri Jan 30 11:13:08 PST 2004 --- patches/ivtools-040130-johnston-006 *************** patches/ivtools-040130-johnston-006 *** 0 **** --- 1 ---- + ivtools-040130-johnston-006 ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn