Ver Fonte

move implementations to header file (Mutex & Cond)

mikymod há 12 anos atrás
pai
commit
e503696387

+ 0 - 2
engine/CMakeLists.txt

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

+ 0 - 60
engine/os/posix/Cond.cpp

@@ -1,60 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <string.h>
-
-#include "Cond.h"
-
-namespace crown
-{
-
-//-----------------------------------------------------------------------------
-Cond::Cond()
-{
-	memset(&m_cond, 0, sizeof(pthread_cond_t));
-
-	pthread_cond_init(&m_cond, NULL);
-}
-
-//-----------------------------------------------------------------------------
-Cond::~Cond()
-{
-	pthread_cond_destroy(&m_cond);
-}
-
-//-----------------------------------------------------------------------------
-void Cond::signal()
-{
-	pthread_cond_signal(&m_cond);
-}
-
-//-----------------------------------------------------------------------------
-void Cond::wait(Mutex& mutex)
-{
-	pthread_cond_wait(&m_cond, &(mutex.m_mutex));
-}
-
-} // namespace crown

+ 27 - 0
engine/os/posix/Cond.h

@@ -27,6 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include <pthread.h>
+#include <cstring>
 
 #include "Types.h"
 #include "Mutex.h"
@@ -56,4 +57,30 @@ private:
 	Cond&			operator=(const Cond&);
 };
 
+//-----------------------------------------------------------------------------
+inline Cond::Cond()
+{
+	memset(&m_cond, 0, sizeof(pthread_cond_t));
+
+	pthread_cond_init(&m_cond, NULL);
+}
+
+//-----------------------------------------------------------------------------
+inline Cond::~Cond()
+{
+	pthread_cond_destroy(&m_cond);
+}
+
+//-----------------------------------------------------------------------------
+inline void Cond::signal()
+{
+	pthread_cond_signal(&m_cond);
+}
+
+//-----------------------------------------------------------------------------
+inline void Cond::wait(Mutex& mutex)
+{
+	pthread_cond_wait(&m_cond, &(mutex.m_mutex));
+}
+
 } // namespace crown

+ 0 - 60
engine/os/posix/Mutex.cpp

@@ -1,60 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <string.h>
-
-#include "Mutex.h"
-
-namespace crown
-{
-
-//-----------------------------------------------------------------------------
-Mutex::Mutex()
-{
-	memset(&m_mutex, 0, sizeof(pthread_mutex_t));
-
-	pthread_mutex_init(&m_mutex, NULL);
-}
-
-//-----------------------------------------------------------------------------
-Mutex::~Mutex()
-{
-	pthread_mutex_destroy(&m_mutex);
-}
-
-//-----------------------------------------------------------------------------
-void Mutex::lock()
-{
-	pthread_mutex_lock(&m_mutex);
-}
-
-//-----------------------------------------------------------------------------
-void Mutex::unlock()
-{
-	pthread_mutex_unlock(&m_mutex);
-}
-
-} // namespace crown

+ 27 - 0
engine/os/posix/Mutex.h

@@ -27,6 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include <pthread.h>
+#include <cstring>
 
 #include "Types.h"
 #include "OS.h"
@@ -57,4 +58,30 @@ private:
 	friend class		Cond;
 };
 
+//-----------------------------------------------------------------------------
+inline Mutex::Mutex()
+{
+	memset(&m_mutex, 0, sizeof(pthread_mutex_t));
+
+	pthread_mutex_init(&m_mutex, NULL);
+}
+
+//-----------------------------------------------------------------------------
+inline Mutex::~Mutex()
+{
+	pthread_mutex_destroy(&m_mutex);
+}
+
+//-----------------------------------------------------------------------------
+inline void Mutex::lock()
+{
+	pthread_mutex_lock(&m_mutex);
+}
+
+//-----------------------------------------------------------------------------
+inline void Mutex::unlock()
+{
+	pthread_mutex_unlock(&m_mutex);
+}
+
 } // namespace crown