00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 //---------------------------------------------------------------------- 00009 //---------------------------------------------------------------------- 00010 #include "ThreadImplPosix.h" 00011 00012 #include "Thread.h" 00013 00014 namespace icl_core { 00015 namespace logging { 00016 00017 ThreadImplPosix::ThreadImplPosix(Thread *thread, icl_core::ThreadPriority priority) 00018 : m_thread_id(0), 00019 m_thread(thread), 00020 m_priority(priority) 00021 { } 00022 00023 ThreadImplPosix::~ThreadImplPosix() 00024 { } 00025 00026 void ThreadImplPosix::join() 00027 { 00028 pthread_join(m_thread_id, NULL); 00029 } 00030 00031 bool ThreadImplPosix::start() 00032 { 00033 if (pthread_create(&m_thread_id, NULL, ThreadImplPosix::runThread, this)) 00034 { 00035 m_thread_id = 0; 00036 } 00037 00038 return m_thread_id != 0; 00039 } 00040 00041 void *ThreadImplPosix::runThread(void *arg) 00042 { 00043 ThreadImplPosix *self = static_cast<ThreadImplPosix*>(arg); 00044 self->m_thread->runThread(); 00045 00046 return NULL; 00047 } 00048 00049 } 00050 }