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 //---------------------------------------------------------------------- 00030 //---------------------------------------------------------------------- 00031 #ifndef ICL_CORE_THREAD_THREAD_IMPL_LXRT38_H_INCLUDED 00032 #define ICL_CORE_THREAD_THREAD_IMPL_LXRT38_H_INCLUDED 00033 00034 #include <rtai_posix.h> 00035 #include <rtai_sem.h> 00036 00037 #include <icl_core/os_thread.h> 00038 00039 #include "icl_core_thread/ThreadImpl.h" 00040 00041 namespace icl_core { 00042 namespace thread { 00043 00044 class Thread; 00045 00050 class ThreadImplLxrt38 : public ThreadImpl, protected virtual icl_core::Noncopyable 00051 { 00052 public: 00053 ThreadImplLxrt38(Thread *thread, const icl_core::String& description, 00054 icl_core::ThreadPriority priority); 00055 00056 virtual ~ThreadImplLxrt38(); 00057 00058 virtual void cancel(); 00059 virtual icl_core::String getDescription() const { return m_description; } 00060 virtual bool isHardRealtime() const; 00061 virtual bool executesHardRealtime() const; 00062 virtual void join(); 00063 virtual icl_core::ThreadPriority priority() const; 00064 virtual void setDescription(const icl_core::String& description) { m_description = description; } 00065 virtual bool setHardRealtime(bool hard_realtime); 00066 virtual bool setPriority(icl_core::ThreadPriority priority); 00067 virtual bool start(); 00068 virtual icl_core::ThreadId threadId() const; 00069 00070 private: 00071 static void *runThread(void *arg); 00072 00073 pthread_t m_thread_id; 00074 Thread *m_thread; 00075 ThreadPriority m_priority; 00076 icl_core::String m_description; 00077 00078 RT_TASK *m_rt_task; 00079 00080 SEM *m_rt_start_sync; 00081 }; 00082 00083 } 00084 } 00085 00086 #endif