Ignore:
Timestamp:
Jun 25, 2009, 11:06:52 AM (15 years ago)
Author:
Christoph Mayer
Message:

-StartupWrapper bisschen umgeschrieben, erste Schritte für sauberes runterfahren

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/system/StartupWrapper.cpp

    r4462 r4483  
    4848
    4949SystemEventType StartupWrapperEventStartup("StartupWrapperEventStartup");
    50 SystemEventType StartupWrapperEventShutdown("StartupWrapperEventShutdown");
    5150
    5251StartupWrapper::StartupWrapper(StartupInterface* _service) : service( _service ){
     
    7372#endif
    7473
    75 void StartupWrapper::initSystem(){
    76 
    77         static bool initialized = false;
    78         if( initialized ) return;
    79         initialized = true;
     74void StartupWrapper::startSystem(){
    8075
    8176        //
     
    121116}
    122117
     118void StartupWrapper::stopSystem(){
     119        SystemQueue::instance().cancel();
     120}
     121
    123122void StartupWrapper::initConfig(string filename){
    124123        configurations.push( filename );
     
    142141
    143142                service->startup();
    144 
    145         } else if( event.getType() == StartupWrapperEventShutdown ){
    146 
    147                 service->shutdown();
    148                 SystemQueue::instance().cancel();
    149143
    150144        }
     
    174168
    175169        if(block){
    176                 SystemEvent ev (service->wrapper, StartupWrapperEventShutdown);
    177                 service->wrapper->handleSystemEvent(ev);
    178 
     170                // call directly
     171                service->shutdown();
    179172        }else{
    180                 SystemQueue::instance().scheduleEvent(
    181                                 SystemEvent( service->wrapper, StartupWrapperEventShutdown, NULL), 0 );
     173                // call async, but not using systemqueue! // TODO: mem leak
     174                AsyncShutdown* async = new AsyncShutdown(service);
     175                async->runBlockingMethod();
    182176        }
    183177}
    184178
     179StartupWrapper::AsyncShutdown::AsyncShutdown(StartupInterface* _service)
     180        : service(_service){
     181}
     182
     183void StartupWrapper::AsyncShutdown::blockingFunction(){
     184        service->shutdown();
     185}
     186
     187void StartupWrapper::AsyncShutdown::dispatchFunction(){
     188        //unused
     189}
     190
    185191}} // namespace ariba, utility
Note: See TracChangeset for help on using the changeset viewer.