diff --git a/src/thread.cpp b/src/thread.cpp index ef28293d5294..cebc94b3ca3d 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -19,9 +19,15 @@ #include "log.hpp" #include "thread.hpp" +#include "SDL_mutex.h" +#include "SDL_thread.h" +#include "SDL_version.h" #define ERR_G LOG_STREAM(err, lg::general) +boost::uint32_t threading::thread::get_id() { return SDL_GetThreadID(thread_); } + +boost::uint32_t threading::get_current_thread_id() { return SDL_ThreadID(); } static int run_async_operation(void* data) { diff --git a/src/thread.hpp b/src/thread.hpp index 9d72b9b41ec0..43e7b7c0be32 100644 --- a/src/thread.hpp +++ b/src/thread.hpp @@ -15,15 +15,26 @@ #ifndef THREAD_HPP_INCLUDED #define THREAD_HPP_INCLUDED -#include "SDL.h" -#include "SDL_thread.h" - #include +#include #include #include #include +struct SDL_Thread; + +#if defined(_MSC_VER) && _MSC_VER <= 1600 +/* + This is needed because msvc up to 2010 fails to correcty forward declare this struct as a return value this case. + And will create corrupt binaries without giving a warning / error. +*/ +#include +#else +struct SDL_mutex; +struct SDL_cond; +#endif + // Threading primitives wrapper for SDL_Thread. // // This module defines primitives for wrapping C++ around SDL's threading @@ -68,13 +79,13 @@ class thread void detach(); - Uint32 get_id() { return SDL_GetThreadID(thread_); } + boost::uint32_t get_id(); private: SDL_Thread* thread_; }; -inline Uint32 get_current_thread_id() { return SDL_ThreadID(); } +boost::uint32_t get_current_thread_id(); // Binary mutexes. // // Implements an interface to binary mutexes. This class only defines the