summaryrefslogtreecommitdiff
path: root/include/SFML/System
diff options
context:
space:
mode:
Diffstat (limited to 'include/SFML/System')
-rwxr-xr-xinclude/SFML/System/Clock.hpp74
-rwxr-xr-xinclude/SFML/System/Lock.hpp71
-rwxr-xr-xinclude/SFML/System/Mutex.hpp45
-rwxr-xr-xinclude/SFML/System/NonCopyable.hpp71
-rwxr-xr-xinclude/SFML/System/Randomizer.hpp94
-rwxr-xr-xinclude/SFML/System/Sleep.hpp47
-rwxr-xr-xinclude/SFML/System/Thread.hpp45
-rwxr-xr-xinclude/SFML/System/Unix/Mutex.hpp82
-rwxr-xr-xinclude/SFML/System/Unix/Thread.hpp124
-rwxr-xr-xinclude/SFML/System/Win32/Mutex.hpp84
-rwxr-xr-xinclude/SFML/System/Win32/Thread.hpp123
11 files changed, 860 insertions, 0 deletions
diff --git a/include/SFML/System/Clock.hpp b/include/SFML/System/Clock.hpp
new file mode 100755
index 0000000..62c9963
--- /dev/null
+++ b/include/SFML/System/Clock.hpp
@@ -0,0 +1,74 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_CLOCK_HPP
+#define SFML_CLOCK_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Clock is an utility class for manipulating time
+////////////////////////////////////////////////////////////
+class SFML_API Clock
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Clock();
+
+ ////////////////////////////////////////////////////////////
+ /// Get the time elapsed since last reset
+ ///
+ /// \return Time elapsed, in seconds
+ ///
+ ////////////////////////////////////////////////////////////
+ float GetElapsedTime() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Restart the timer
+ ///
+ ////////////////////////////////////////////////////////////
+ void Reset();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ double myStartTime; ///< Time of last reset
+};
+
+} // namespace sf
+
+
+#endif // SFML_CLOCK_HPP
diff --git a/include/SFML/System/Lock.hpp b/include/SFML/System/Lock.hpp
new file mode 100755
index 0000000..69074ce
--- /dev/null
+++ b/include/SFML/System/Lock.hpp
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_LOCK_HPP
+#define SFML_LOCK_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/System/NonCopyable.hpp>
+
+
+namespace sf
+{
+class Mutex;
+
+////////////////////////////////////////////////////////////
+/// Lock is an exception-safe automatic wrapper for
+/// locking and unlocking mutexes
+////////////////////////////////////////////////////////////
+class SFML_API Lock : NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the lock with a target mutex (lock it)
+ ///
+ /// @param Mutex : Mutex to lock
+ ///
+ ////////////////////////////////////////////////////////////
+ Lock(Mutex& Mutex);
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor (unlocks the mutex)
+ ///
+ ////////////////////////////////////////////////////////////
+ ~Lock();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ Mutex& myMutex; ///< Mutex to lock / unlock
+};
+
+} // namespace sf
+
+
+#endif // SFML_LOCK_HPP
diff --git a/include/SFML/System/Mutex.hpp b/include/SFML/System/Mutex.hpp
new file mode 100755
index 0000000..be392a5
--- /dev/null
+++ b/include/SFML/System/Mutex.hpp
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_MUTEX_HPP
+#define SFML_MUTEX_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+#ifdef SFML_SYSTEM_WINDOWS
+
+ #include <SFML/System/Win32/Mutex.hpp>
+
+#else
+
+ #include <SFML/System/Unix/Mutex.hpp>
+
+#endif
+
+
+#endif // SFML_MUTEX_HPP
diff --git a/include/SFML/System/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp
new file mode 100755
index 0000000..984f716
--- /dev/null
+++ b/include/SFML/System/NonCopyable.hpp
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_NONCOPYABLE_HPP
+#define SFML_NONCOPYABLE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Utility base class to easily declare non-copyable classes.
+/// Just inherit from NonCopyable to get a non-copyable class
+////////////////////////////////////////////////////////////
+class SFML_API NonCopyable
+{
+protected :
+
+ ////////////////////////////////////////////////////////////
+ /// The default constructor won't be generated, so provide it
+ ///
+ ////////////////////////////////////////////////////////////
+ NonCopyable() {}
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// Copy constructor : declare it private and don't implement
+ /// it to prevent from calling it
+ ///
+ ////////////////////////////////////////////////////////////
+ NonCopyable(const NonCopyable&);
+
+ ////////////////////////////////////////////////////////////
+ /// Assignment operator : declare it private and don't implement
+ /// it to prevent from calling it
+ ///
+ ////////////////////////////////////////////////////////////
+ NonCopyable& operator =(const NonCopyable&);
+};
+
+} // namespace sf
+
+
+#endif // SFML_NONCOPYABLE_HPP
diff --git a/include/SFML/System/Randomizer.hpp b/include/SFML/System/Randomizer.hpp
new file mode 100755
index 0000000..0f8f6c9
--- /dev/null
+++ b/include/SFML/System/Randomizer.hpp
@@ -0,0 +1,94 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_RANDOMIZER_HPP
+#define SFML_RANDOMIZER_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Randomizer is an utility class for generating pseudo-random
+/// numbers
+////////////////////////////////////////////////////////////
+class SFML_API Randomizer
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Set the seed for the generator. Using a known seed
+ /// allows you to reproduce the same sequence of random number
+ ///
+ /// \param Seed : Number to use as the seed
+ ///
+ ////////////////////////////////////////////////////////////
+ static void SetSeed(unsigned int Seed);
+
+ ////////////////////////////////////////////////////////////
+ /// Get the seed used to generate random numbers the generator.
+ ///
+ /// \return Current seed
+ ///
+ ////////////////////////////////////////////////////////////
+ static unsigned int GetSeed();
+
+ ////////////////////////////////////////////////////////////
+ /// Get a random float number in a given range
+ ///
+ /// \return Start : Start of the range
+ /// \return End : End of the range
+ ///
+ /// \return Random number in [Begin, End]
+ ///
+ ////////////////////////////////////////////////////////////
+ static float Random(float Begin, float End);
+
+ ////////////////////////////////////////////////////////////
+ /// Get a random integer number in a given range
+ ///
+ /// \return Start : Start of the range
+ /// \return End : End of the range
+ ///
+ /// \return Random number in [Begin, End]
+ ///
+ ////////////////////////////////////////////////////////////
+ static int Random(int Begin, int End);
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Static member variables
+ ////////////////////////////////////////////////////////////
+ static unsigned int ourSeed;
+};
+
+} // namespace sf
+
+
+#endif // SFML_RANDOMIZER_HPP
diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp
new file mode 100755
index 0000000..c2c0890
--- /dev/null
+++ b/include/SFML/System/Sleep.hpp
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_SLEEP_HPP
+#define SFML_SLEEP_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+namespace sf
+{
+ ////////////////////////////////////////////////////////////
+ /// Make the current thread sleep for a given time
+ ///
+ /// \param Duration : Time to sleep, in seconds
+ ///
+ ////////////////////////////////////////////////////////////
+ void SFML_API Sleep(float Duration);
+
+} // namespace sf
+
+
+#endif // SFML_SLEEP_HPP
diff --git a/include/SFML/System/Thread.hpp b/include/SFML/System/Thread.hpp
new file mode 100755
index 0000000..f0822b3
--- /dev/null
+++ b/include/SFML/System/Thread.hpp
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_THREAD_HPP
+#define SFML_THREAD_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+#ifdef SFML_SYSTEM_WINDOWS
+
+ #include <SFML/System/Win32/Thread.hpp>
+
+#else
+
+ #include <SFML/System/Unix/Thread.hpp>
+
+#endif
+
+
+#endif // SFML_THREAD_HPP
diff --git a/include/SFML/System/Unix/Mutex.hpp b/include/SFML/System/Unix/Mutex.hpp
new file mode 100755
index 0000000..f8f24b6
--- /dev/null
+++ b/include/SFML/System/Unix/Mutex.hpp
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_MUTEXUNIX_HPP
+#define SFML_MUTEXUNIX_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/System/NonCopyable.hpp>
+#include <pthread.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Mutex defines a mutex (MUTual EXclusion) object,
+/// that allows a thread to lock critical instructions
+/// to avoid simultaneous access with other threads.
+/// See Lock for an efficient way of using it.
+////////////////////////////////////////////////////////////
+class SFML_API Mutex : NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Mutex();
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ ~Mutex();
+
+ ////////////////////////////////////////////////////////////
+ /// Lock the mutex
+ ///
+ ////////////////////////////////////////////////////////////
+ void Lock();
+
+ ////////////////////////////////////////////////////////////
+ /// Unlock the mutex
+ ///
+ ////////////////////////////////////////////////////////////
+ void Unlock();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ pthread_mutex_t myMutex; ///< pthread instance of the mutex
+};
+
+} // namespace sf
+
+
+#endif // SFML_MUTEXUNIX_HPP
diff --git a/include/SFML/System/Unix/Thread.hpp b/include/SFML/System/Unix/Thread.hpp
new file mode 100755
index 0000000..b26d38f
--- /dev/null
+++ b/include/SFML/System/Unix/Thread.hpp
@@ -0,0 +1,124 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_THREADUNIX_HPP
+#define SFML_THREADUNIX_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/System/NonCopyable.hpp>
+#include <pthread.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Thread defines a thread.
+/// There is two ways to use Thread :
+/// - Inherit from it and override the Run() virtual function
+/// - Construct a sfThread instance and pass it a function
+/// pointer to call
+////////////////////////////////////////////////////////////
+class SFML_API Thread : NonCopyable
+{
+public :
+
+ typedef void (*FuncType)(void*);
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the thread from a function pointer
+ ///
+ /// \param Function : Entry point of the thread
+ /// \param UserData : Data to pass to the thread function (NULL by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ Thread(FuncType Function, void* UserData = NULL);
+
+ ////////////////////////////////////////////////////////////
+ /// Virtual destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~Thread();
+
+ ////////////////////////////////////////////////////////////
+ /// Create and run the thread
+ ///
+ ////////////////////////////////////////////////////////////
+ void Launch();
+
+ ////////////////////////////////////////////////////////////
+ /// Wait until the thread finishes
+ ///
+ ////////////////////////////////////////////////////////////
+ void Wait();
+
+ ////////////////////////////////////////////////////////////
+ /// Terminate the thread
+ /// Terminating a thread with this function is not safe,
+ /// you should rather try to make the thread function
+ /// terminate by itself
+ ///
+ ////////////////////////////////////////////////////////////
+ void Terminate();
+
+protected :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Thread();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// Function called as the thread entry point
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void Run();
+
+ ////////////////////////////////////////////////////////////
+ /// Actual thread entry point, dispatches to instances
+ ///
+ /// \param UserData : Data to pass to the thread function
+ ///
+ /// \return Error code
+ ///
+ ////////////////////////////////////////////////////////////
+ static void* ThreadFunc(void* UserData);
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ pthread_t myThread; ///< Unix thread instance
+ bool myIsActive; ///< Thread state (active or inactive)
+ FuncType myFunction; ///< Function to call as the thread entry point
+ void* myUserData; ///< Data to pass to the thread function
+};
+
+} // namespace sf
+
+
+#endif // SFML_THREADUNIX_HPP
diff --git a/include/SFML/System/Win32/Mutex.hpp b/include/SFML/System/Win32/Mutex.hpp
new file mode 100755
index 0000000..005a8c7
--- /dev/null
+++ b/include/SFML/System/Win32/Mutex.hpp
@@ -0,0 +1,84 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_MUTEXWIN32_HPP
+#define SFML_MUTEXWIN32_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/System/NonCopyable.hpp>
+#include <windows.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Mutex defines a mutex (MUTual EXclusion) object,
+/// that allows a thread to lock critical instructions
+/// to avoid simultaneous access with other threads.
+/// The Win32 version uses critical sections, as it is
+/// faster than mutexes.<br/>
+/// See Lock for an efficient way of using it.
+////////////////////////////////////////////////////////////
+class SFML_API Mutex : NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Mutex();
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ ~Mutex();
+
+ ////////////////////////////////////////////////////////////
+ /// Lock the mutex
+ ///
+ ////////////////////////////////////////////////////////////
+ void Lock();
+
+ ////////////////////////////////////////////////////////////
+ /// Unlock the mutex
+ ///
+ ////////////////////////////////////////////////////////////
+ void Unlock();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ CRITICAL_SECTION myHandle; ///< Win32 handle of the mutex
+};
+
+} // namespace sf
+
+
+#endif // SFML_MUTEXWIN32_HPP
diff --git a/include/SFML/System/Win32/Thread.hpp b/include/SFML/System/Win32/Thread.hpp
new file mode 100755
index 0000000..6a3ca4b
--- /dev/null
+++ b/include/SFML/System/Win32/Thread.hpp
@@ -0,0 +1,123 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_THREADWIN32_HPP
+#define SFML_THREADWIN32_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/System/NonCopyable.hpp>
+#include <windows.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Thread defines an easy way to manipulate a thread.
+/// There are two ways to use Thread :
+/// - Inherit from it and override the Run() virtual function
+/// - Construct a Thread instance and pass it a function
+/// pointer to call
+////////////////////////////////////////////////////////////
+class SFML_API Thread : NonCopyable
+{
+public :
+
+ typedef void (*FuncType)(void*);
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the thread from a function pointer
+ ///
+ /// \param Function : Entry point of the thread
+ /// \param UserData : Data to pass to the thread function (NULL by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ Thread(FuncType Function, void* UserData = NULL);
+
+ ////////////////////////////////////////////////////////////
+ /// Virtual destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~Thread();
+
+ ////////////////////////////////////////////////////////////
+ /// Create and run the thread
+ ///
+ ////////////////////////////////////////////////////////////
+ void Launch();
+
+ ////////////////////////////////////////////////////////////
+ /// Wait until the thread finishes
+ ///
+ ////////////////////////////////////////////////////////////
+ void Wait();
+
+ ////////////////////////////////////////////////////////////
+ /// Terminate the thread
+ /// Terminating a thread with this function is not safe,
+ /// you should rather try to make the thread function
+ /// terminate by itself
+ ///
+ ////////////////////////////////////////////////////////////
+ void Terminate();
+
+protected :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Thread();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// Function called as the thread entry point
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void Run();
+
+ ////////////////////////////////////////////////////////////
+ /// Actual thread entry point, dispatches to instances
+ ///
+ /// \param UserData : Data to pass to the thread function
+ ///
+ /// \return Error code
+ ///
+ ////////////////////////////////////////////////////////////
+ static unsigned int __stdcall ThreadFunc(void* UserData);
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ HANDLE myHandle; ///< Win32 thread handle
+ FuncType myFunction; ///< Function to call as the thread entry point
+ void* myUserData; ///< Data to pass to the thread function
+};
+
+} // namespace sf
+
+
+#endif // SFML_THREADWIN32_HPP