00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 // This file is part of FZIs ic_workspace. 00005 // 00006 // This program is free software licensed under the LGPL 00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3). 00008 // You can find a copy of this license in LICENSE folder in the top 00009 // directory of the source code. 00010 // 00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00012 // 00013 // -- END LICENSE BLOCK ------------------------------------------------ 00014 00015 //---------------------------------------------------------------------- 00021 //---------------------------------------------------------------------- 00022 #include "PeriodicThreadImplLxrt38.h" 00023 00024 #include <rtai_lxrt.h> 00025 00026 #include <icl_core/os_lxrt.h> 00027 00028 namespace icl_core { 00029 namespace thread { 00030 00031 PeriodicThreadImplLxrt38::PeriodicThreadImplLxrt38(const icl_core::TimeSpan& period) 00032 : m_period(period) 00033 { 00034 } 00035 00036 PeriodicThreadImplLxrt38::~PeriodicThreadImplLxrt38() 00037 { 00038 } 00039 00040 void PeriodicThreadImplLxrt38::makePeriodic() 00041 { 00042 rt_task_make_periodic_relative_ns(rt_buddy(), 0, m_period.toNSec()); 00043 } 00044 00045 bool PeriodicThreadImplLxrt38::setPeriod(const icl_core::TimeSpan& period) 00046 { 00047 m_period = period; 00048 return true; 00049 } 00050 00051 void PeriodicThreadImplLxrt38::waitPeriod() 00052 { 00053 while (rt_task_wait_period()) 00054 { } 00055 } 00056 00057 } 00058 }