Skip to content

Commit

Permalink
move SDL threading includes out of header
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 19, 2014
1 parent 6b477da commit 19f85df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/thread.cpp
Expand Up @@ -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)
{
Expand Down
21 changes: 16 additions & 5 deletions src/thread.hpp
Expand Up @@ -15,15 +15,26 @@
#ifndef THREAD_HPP_INCLUDED
#define THREAD_HPP_INCLUDED

#include "SDL.h"
#include "SDL_thread.h"

#include <list>

#include <boost/cstdint.hpp>
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/smart_ptr.hpp>

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 <SDL_mutex.h>
#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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 19f85df

Please sign in to comment.