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 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00012 // 00013 // -- END LICENSE BLOCK ------------------------------------------------ 00014 00015 //---------------------------------------------------------------------- 00030 //---------------------------------------------------------------------- 00031 #ifndef ICL_CORE_THREAD_THREAD_IMPL_POSIX_H_INCLUDED 00032 #define ICL_CORE_THREAD_THREAD_IMPL_POSIX_H_INCLUDED 00033 00034 #include <icl_core/os_thread.h> 00035 00036 #include "icl_core_thread/ThreadImpl.h" 00037 00038 namespace icl_core { 00039 namespace thread { 00040 00041 class Thread; 00042 00047 class ThreadImplPosix : public ThreadImpl, protected virtual icl_core::Noncopyable 00048 { 00049 public: 00050 ThreadImplPosix(Thread *thread, const icl_core::String& description, icl_core::ThreadPriority priority); 00051 00052 virtual ~ThreadImplPosix(); 00053 00054 virtual void cancel(); 00055 virtual icl_core::String getDescription() const { return m_description; } 00056 virtual bool isHardRealtime() const { return false; } 00057 virtual bool executesHardRealtime() const { return false; } 00058 virtual void join(); 00059 virtual icl_core::ThreadPriority priority() const; 00060 virtual void setDescription(const icl_core::String& description) { m_description = description; } 00061 virtual bool setHardRealtime(bool hard_realtime) { return !hard_realtime; } 00062 virtual bool setPriority(icl_core::ThreadPriority priority); 00063 virtual bool start(); 00064 virtual icl_core::ThreadId threadId() const; 00065 00066 //static ::icl_core::ThreadPriority maxPriorityImpl(bool realtime = false) 00067 //{ 00068 // return 20; 00069 //} 00070 00071 //static ::icl_core::ThreadPriority minPriorityImpl(bool realtime = false) 00072 //{ 00073 // return 1; 00074 //} 00075 00076 private: 00077 static void *runThread(void *arg); 00078 00079 pthread_t m_thread_id; 00080 Thread *m_thread; 00081 icl_core::ThreadPriority m_priority; 00082 icl_core::String m_description; 00083 }; 00084 00085 } 00086 } 00087 00088 #endif