ソースを参照

Rename Thread to OsThread

Daniele Bartolini 12 年 前
コミット
b33a9ae601
3 ファイル変更16 行追加16 行削除
  1. 1 1
      engine/CMakeLists.txt
  2. 1 1
      engine/os/linux/OsThread.h
  3. 14 14
      engine/os/posix/OsThread.h

+ 1 - 1
engine/CMakeLists.txt

@@ -363,7 +363,7 @@ if (LINUX)
 		os/linux/TCPSocket.h
 		os/linux/TCPSocket.h
 		os/linux/UDPSocket.h
 		os/linux/UDPSocket.h
 		os/linux/OsFile.h
 		os/linux/OsFile.h
-		os/linux/Thread.h
+		os/linux/OsThread.h
 		os/linux/Mutex.h
 		os/linux/Mutex.h
 		os/linux/Cond.h
 		os/linux/Cond.h
 		os/posix/Semaphore.h
 		os/posix/Semaphore.h

+ 1 - 1
engine/os/linux/Thread.h → engine/os/linux/OsThread.h

@@ -26,4 +26,4 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 
 #pragma once
 #pragma once
 
 
-#include "../posix/Thread.h"
+#include "../posix/OsThread.h"

+ 14 - 14
engine/os/posix/Thread.h → engine/os/posix/OsThread.h

@@ -38,12 +38,12 @@ namespace crown
 
 
 typedef int32_t (*ThreadFunction)(void*);
 typedef int32_t (*ThreadFunction)(void*);
 
 
-class Thread
+class OsThread
 {
 {
 public:
 public:
 
 
-						Thread(const char* name);
-						~Thread();
+						OsThread(const char* name);
+						~OsThread();
 
 
 	void				start(ThreadFunction func, void* data = NULL, size_t stack_size = 0);
 	void				start(ThreadFunction func, void* data = NULL, size_t stack_size = 0);
 	void				stop();
 	void				stop();
@@ -70,7 +70,7 @@ private:
 };
 };
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline Thread::Thread(const char* name) :
+inline OsThread::OsThread(const char* name) :
 	m_name(name),
 	m_name(name),
 	m_handle(0),
 	m_handle(0),
 	m_function(NULL),
 	m_function(NULL),
@@ -82,14 +82,14 @@ inline Thread::Thread(const char* name) :
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline Thread::~Thread()
+inline OsThread::~OsThread()
 {
 {
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline void Thread::start(ThreadFunction func, void* data, size_t stack_size)
+inline void OsThread::start(ThreadFunction func, void* data, size_t stack_size)
 {
 {
-	CE_ASSERT(!m_is_running, "Thread is already running");
+	CE_ASSERT(!m_is_running, "OsThread is already running");
 	CE_ASSERT(func != NULL, "Function must be != NULL");
 	CE_ASSERT(func != NULL, "Function must be != NULL");
 
 
 	m_function = func;
 	m_function = func;
@@ -122,25 +122,25 @@ inline void Thread::start(ThreadFunction func, void* data, size_t stack_size)
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline void Thread::stop()
+inline void OsThread::stop()
 {
 {
-	CE_ASSERT(m_is_running, "Thread is not running");
+	CE_ASSERT(m_is_running, "OsThread is not running");
 	
 	
 	int32_t result = pthread_join(m_handle, NULL);
 	int32_t result = pthread_join(m_handle, NULL);
-	CE_ASSERT(result == 0, "Thread join failed. errno: %d", result);
+	CE_ASSERT(result == 0, "OsThread join failed. errno: %d", result);
 
 
 	m_is_running = false;
 	m_is_running = false;
 	m_handle = 0;
 	m_handle = 0;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline bool Thread::is_running()
+inline bool OsThread::is_running()
 {
 {
 	return m_is_running;
 	return m_is_running;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline int32_t Thread::run()
+inline int32_t OsThread::run()
 {
 {
 	m_sem.post();
 	m_sem.post();
 	
 	
@@ -148,10 +148,10 @@ inline int32_t Thread::run()
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline void* Thread::thread_proc(void* arg)
+inline void* OsThread::thread_proc(void* arg)
 {
 {
 	static int32_t result = -1;
 	static int32_t result = -1;
-	result = ((Thread*)arg)->run();
+	result = ((OsThread*)arg)->run();
 
 
 	return (void*)&result;
 	return (void*)&result;
 }
 }