Project

General

Profile

Bug #2517

Updated by Alex Afanasyev about 9 years ago

Given the following pseudocode: 

     class NfdRunner 
     { 
     public: 
       NfdRunner(const std::string& file) 
         : m_nfd(configFile, m_keyChain) 
         , m_nrd(config, m_keyChain) 
    
       { 
         m_nfd.initialize(); 
         m_nrd.initialize(); 
       } 
    
     private: 
       Nfd m_nfd; 
       rib::Nrd m_nrd; 
     }; 
    
    
     NfdRunner* r = new NfdRunner("nfd.conf"); 
     boost::asio::io_service* io = &getGlobalIoService(); 
    
     boost::thread t = boost::thread([&] { 
         boost::this_thread::sleep_for(time::seconds(2)); 
         delete r; 
       }); 
    
     globalIoService().run(); 

 There should not be any segfault produced as a result of this execution.    NfdRunner destructor should destroy instances of nrd, nfd, which in turn should destroy everything internally and cancel everything that was posted on the global IO service.    After everything is properly cancelled, the app should terminate.

Back