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 //---------------------------------------------------------------------- 00022 //---------------------------------------------------------------------- 00023 #include "icl_core/os_posix_thread.h" 00024 00025 #include "icl_core/os_lxrt.h" 00026 00027 #ifdef _SYSTEM_LXRT_ 00028 # include <stdlib.h> 00029 # include <rtai_lxrt.h> 00030 # include <rtai_posix.h> 00031 #endif 00032 00033 namespace icl_core { 00034 namespace os { 00035 namespace hidden_posix { 00036 00037 bool operator == (const ThreadId& left, const ThreadId& right) 00038 { 00039 #ifdef _SYSTEM_LXRT_ 00040 if (isThisLxrtTask()) 00041 { 00042 return pthread_equal_rt(left.m_thread_id, right.m_thread_id); 00043 } 00044 else 00045 #endif 00046 { 00047 return pthread_equal(left.m_thread_id, right.m_thread_id); 00048 } 00049 } 00050 00051 ThreadId threadSelf() 00052 { 00053 #ifdef _SYSTEM_LXRT_ 00054 if (isThisLxrtTask()) 00055 { 00056 return ThreadId(pthread_self_rt()); 00057 } 00058 else 00059 #endif 00060 { 00061 return ThreadId(pthread_self()); 00062 } 00063 } 00064 00065 pid_t getpid() 00066 { 00067 return ::getpid(); 00068 } 00069 00070 } 00071 } 00072 }