Browse Source

Rename OsThread to Thread

Daniele Bartolini 12 years ago
parent
commit
e245807156

+ 0 - 1
engine/Android.mk

@@ -69,7 +69,6 @@ LOCAL_SRC_FILES :=\
 	os/android/ApkFile.cpp\
 	os/android/ApkFile.cpp\
 	os/android/ApkFilesystem.cpp\
 	os/android/ApkFilesystem.cpp\
 	os/posix/OsFile.cpp\
 	os/posix/OsFile.cpp\
-	os/posix/Thread.cpp\
 	os/posix/Mutex.cpp\
 	os/posix/Mutex.cpp\
 	os/posix/Cond.cpp\
 	os/posix/Cond.cpp\
 	os/posix/TCPSocket.cpp\
 	os/posix/TCPSocket.cpp\

+ 0 - 1
engine/CMakeLists.txt

@@ -379,7 +379,6 @@ if (LINUX)
 		os/posix/TCPSocket.cpp
 		os/posix/TCPSocket.cpp
 		os/posix/UDPSocket.cpp	
 		os/posix/UDPSocket.cpp	
 		os/posix/OsFile.cpp
 		os/posix/OsFile.cpp
-		os/posix/Thread.cpp
 	)
 	)
 
 
 	list (APPEND RENDERERS_SRC
 	list (APPEND RENDERERS_SRC

+ 1 - 1
engine/os/linux/main.cpp

@@ -35,7 +35,7 @@ struct MainArgs
 	char** argv;
 	char** argv;
 };
 };
 
 
-static OsThread thread("main-thread");
+static Thread thread("main-thread");
 
 
 int32_t main_thread(void* data)
 int32_t main_thread(void* data)
 {
 {

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

@@ -36,16 +36,16 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 namespace crown
 {
 {
 
 
-typedef int32_t (*OsThreadFunction)(void*);
+typedef int32_t (*ThreadFunction)(void*);
 
 
-class OsThread
+class Thread
 {
 {
 public:
 public:
 
 
-						OsThread(const char* name);
-						~OsThread();
+						Thread(const char* name);
+						~Thread();
 
 
-	void				start(OsThreadFunction 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();
 
 
 	bool				is_running();
 	bool				is_running();
@@ -61,7 +61,7 @@ private:
 	const char* 		m_name;
 	const char* 		m_name;
 
 
 	pthread_t			m_handle;
 	pthread_t			m_handle;
-	OsThreadFunction 	m_function;
+	ThreadFunction 	m_function;
 	void*				m_data;
 	void*				m_data;
 	Semaphore			m_sem;
 	Semaphore			m_sem;
 	size_t 				m_stack_size;
 	size_t 				m_stack_size;
@@ -70,7 +70,7 @@ private:
 };
 };
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline OsThread::OsThread(const char* name) :
+inline Thread::Thread(const char* name) :
 	m_name(name),
 	m_name(name),
 	m_handle(0),
 	m_handle(0),
 	m_function(NULL),
 	m_function(NULL),
@@ -82,12 +82,12 @@ inline OsThread::OsThread(const char* name) :
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline OsThread::~OsThread()
+inline Thread::~Thread()
 {
 {
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline void OsThread::start(OsThreadFunction func, void* data, size_t stack_size)
+inline void Thread::start(ThreadFunction func, void* data, size_t stack_size)
 {
 {
 	CE_ASSERT(!m_is_running, "Thread is already running");
 	CE_ASSERT(!m_is_running, "Thread is already running");
 	CE_ASSERT(func != NULL, "Function must be != NULL");
 	CE_ASSERT(func != NULL, "Function must be != NULL");
@@ -122,7 +122,7 @@ inline void OsThread::start(OsThreadFunction func, void* data, size_t stack_size
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline void OsThread::stop()
+inline void Thread::stop()
 {
 {
 	CE_ASSERT(m_is_running, "Thread is not running");
 	CE_ASSERT(m_is_running, "Thread is not running");
 	
 	
@@ -136,13 +136,13 @@ inline void OsThread::stop()
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline bool OsThread::is_running()
+inline bool Thread::is_running()
 {
 {
 	return m_is_running;
 	return m_is_running;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline int32_t OsThread::run()
+inline int32_t Thread::run()
 {
 {
 	m_sem.post();
 	m_sem.post();
 	
 	
@@ -150,9 +150,9 @@ inline int32_t OsThread::run()
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-inline void* OsThread::thread_proc(void* arg)
+inline void* Thread::thread_proc(void* arg)
 {
 {
-	OsThread* thread = (OsThread*)arg;
+	Thread* thread = (Thread*)arg;
 
 
 	int32_t result = thread->run();
 	int32_t result = thread->run();
 
 

+ 1 - 1
engine/resource/ResourceLoader.h

@@ -105,7 +105,7 @@ private:
 
 
 private:
 private:
 
 
-	OsThread				m_thread;
+	Thread					m_thread;
 
 
 	// Whether to look for resources
 	// Whether to look for resources
 	Bundle&					m_bundle;
 	Bundle&					m_bundle;

+ 2 - 2
engine/tests/threads.cpp

@@ -7,7 +7,7 @@ using namespace crown;
 
 
 int32_t first_function(void* ft)
 int32_t first_function(void* ft)
 {
 {
-	OsThread* thread = (OsThread*)ft;
+	Thread* thread = (Thread*)ft;
 
 
 	while(thread->is_running())
 	while(thread->is_running())
 	{
 	{
@@ -19,7 +19,7 @@ int32_t first_function(void* ft)
 	
 	
 int main()
 int main()
 {
 {
-	OsThread ft("first-thread");
+	Thread ft("first-thread");
 
 
 	ft.start(first_function, &ft);
 	ft.start(first_function, &ft);