ExtTrigExecutionContext.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00020 #include <coil/TimeValue.h>
00021 #include <rtm/ExtTrigExecutionContext.h>
00022 #include <rtm/ECFactory.h>
00023 
00024 namespace RTC
00025 {
00033   ExtTrigExecutionContext::ExtTrigExecutionContext()
00034     : PeriodicExecutionContext()
00035   {
00036     rtclog.setName("exttrig_ec");
00037   }
00038   
00046   ExtTrigExecutionContext::~ExtTrigExecutionContext()
00047   {
00048   }
00049   
00057   void ExtTrigExecutionContext::tick()
00058     throw (CORBA::SystemException)
00059   {
00060     RTC_TRACE(("tick()"));
00061     m_worker._mutex.lock();
00062     m_worker._called = true;
00063     m_worker._cond.signal();
00064     m_worker._mutex.unlock();
00065     return;
00066   }
00067   
00075   int ExtTrigExecutionContext::svc(void)
00076   {
00077     RTC_TRACE(("svc()"));
00078     do
00079       {
00080         m_worker._mutex.lock();
00081         while (!m_worker._called && m_running)
00082           {
00083             m_worker._cond.wait();
00084           }
00085         if (m_worker._called)
00086           {
00087             m_worker._called = false;
00088             std::for_each(m_comps.begin(), m_comps.end(), invoke_worker());
00089           }
00090         m_worker._mutex.unlock();
00091       } while (m_running);
00092     
00093     return 0;
00094   }
00095 };
00096 
00097 
00098 extern "C"
00099 {
00107   void ExtTrigExecutionContextInit(RTC::Manager* manager)
00108   {
00109     manager->registerECFactory("ExtTrigExecutionContext",
00110                                RTC::ECCreate<RTC::ExtTrigExecutionContext>,
00111                                RTC::ECDelete<RTC::ExtTrigExecutionContext>);
00112   }
00113 };


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:37