Changeset 288 in pacpusframework for trunk/src/PacpusLib/ComponentBase.cpp
- Timestamp:
- Mar 26, 2014, 9:27:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PacpusLib/ComponentBase.cpp
r286 r288 17 17 #include <boost/program_options/parsers.hpp> 18 18 #include <boost/program_options/variables_map.hpp> 19 #include <boost/thread/thread.hpp>19 //#include <boost/thread/thread.hpp> 20 20 #include <ostream> 21 21 #include <string> … … 77 77 DECLARE_STATIC_LOGGER("pacpus.core.ComponentBase"); 78 78 79 ComponentBase::ComponentBase( const QString& componentName)79 ComponentBase::ComponentBase(QString const& componentName) 80 80 : m_componentName(componentName) 81 81 , m_isActive(false) … … 131 131 } 132 132 133 void ComponentBase::startComponentWithException(boost::exception_ptr& error)134 {135 try {136 startActivity();137 error = boost::exception_ptr();138 } catch (...) {139 error = boost::current_exception();140 }141 }142 143 void ComponentBase::startComponentInThread()144 {145 boost::exception_ptr error;146 boost::thread t(147 boost::bind(148 &ComponentBase::startComponentWithException,149 this,150 boost::ref(error)151 )152 );153 t.join();154 if (error) {155 try {156 boost::rethrow_exception(error);157 } catch (boost::exception& e) {158 LOG_FATAL("[" << getName() << "]" << "\tboost::exception thrown: " << boost::diagnostic_information(e));159 //throw;160 }161 }162 }133 //void ComponentBase::startComponentWithException(boost::exception_ptr& error) 134 //{ 135 // try { 136 // startActivity(); 137 // error = boost::exception_ptr(); 138 // } catch (...) { 139 // error = boost::current_exception(); 140 // } 141 //} 142 // 143 //void ComponentBase::startComponentInThread() 144 //{ 145 // boost::exception_ptr error; 146 // boost::thread t( 147 // boost::bind( 148 // &ComponentBase::startComponentWithException, 149 // this, 150 // boost::ref(error) 151 // ) 152 // ); 153 // t.join(); 154 // if (error) { 155 // try { 156 // boost::rethrow_exception(error); 157 // } catch (boost::exception& e) { 158 // LOG_FATAL("[" << getName() << "]" << "\tboost::exception thrown: " << boost::diagnostic_information(e)); 159 // //throw; 160 // } 161 // } 162 //} 163 163 164 164 int ComponentBase::startComponent() … … 170 170 171 171 setActive(true); 172 boost::thread worker(&ComponentBase::startComponentInThread, this); 173 //boost::thread worker(&ComponentBase::startActivity, this); 174 //startActivity(); 172 //boost::thread worker(&ComponentBase::startComponentInThread, this); 173 startActivity(); 174 //moveToThread(&mThread); 175 //mThread.start(); 175 176 return true; 176 177 } … … 185 186 setActive(false); 186 187 stopActivity(); 187 188 //QMetaObject::invokeMethod(&mThread, "quit"); 188 189 return true; 189 190 }
Note:
See TracChangeset
for help on using the changeset viewer.