Merge branch 'osx-libcxx'

This commit is contained in:
Pierre Bourdon
2013-04-01 18:17:49 +02:00
10 changed files with 64 additions and 38 deletions

View File

@ -46,7 +46,7 @@ public:
void Log(LogTypes::LOG_LEVELS, const char *msg);
bool IsValid() { return (m_logfile != NULL); }
bool IsValid() { return (bool)m_logfile; }
bool IsEnabled() const { return m_enable; }
void SetEnable(bool enable) { m_enable = enable; }

View File

@ -5,9 +5,26 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
#define __has_include(s) 0
#endif
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <condition_variable>
#include <condition_variable>
#elif __has_include(<condition_variable>)
// clang and libc++ provide <condition_variable> on OSX. However, the version
// of libc++ bundled with OSX 10.7 and 10.8 is buggy: it uses _ as a variable.
//
// We work around this issue by undefining and redefining _.
#undef _
#include <condition_variable>
#define _(s) wxGetTranslation((s))
#else
// partial std::condition_variable implementation for win32/pthread

View File

@ -5,9 +5,16 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
#define __has_include(s) 0
#endif
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <mutex>
#include <mutex>
#elif __has_include(<mutex>)
// Clang + libc++
#include <mutex>
#else
// partial <mutex> implementation for win32/pthread

View File

@ -5,12 +5,19 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
#define __has_include(s) 0
#endif
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <thread>
#ifndef _GLIBCXX_USE_SCHED_YIELD
#define _GLIBCXX_USE_SCHED_YIELD
#endif
#include <thread>
#elif __has_include(<thread>)
// Clang + libc++
#include <thread>
#else
// partial std::thread implementation for win32/pthread

View File

@ -18,9 +18,9 @@
#ifndef _THREAD_H_
#define _THREAD_H_
#include "StdThread.h"
#include "StdMutex.h"
#include "StdConditionVariable.h"
#include "StdMutex.h"
#include "StdThread.h"
// Don't include common.h here as it will break LogManager
#include "CommonTypes.h"

View File

@ -75,7 +75,7 @@ public:
virtual void DoState(PointerWrap& p);
// Needed because StdThread.h std::thread implem does not support member
// pointers.
// pointers. TODO(delroth): obsolete.
static void SpawnAXThread(CUCode_AX* self);
protected:
@ -107,13 +107,13 @@ protected:
volatile u16 m_cmdlist[512];
volatile u32 m_cmdlist_size;
std::thread m_axthread;
// Sync objects
std::mutex m_processing;
std::condition_variable m_cmdlist_cv;
std::mutex m_cmdlist_mutex;
std::thread m_axthread;
// Copy a command list from memory to our temp buffer
void CopyCmdList(u32 addr, u16 size);

View File

@ -18,6 +18,7 @@
#include <string> // System
#include <vector>
#include <algorithm>
#include <functional>
#include <wx/spinbutt.h>
#include "Common.h"
@ -43,14 +44,6 @@
#include "Main.h"
#include "VideoBackendBase.h"
#if defined(__APPLE__)
#include <tr1/functional>
using std::tr1::function;
#else
#include <functional>
using std::function;
#endif
#define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text, wxDefaultPosition, wxDefaultSize)
struct CPUCore
@ -631,7 +624,7 @@ void CConfigMain::CreateGUIControls()
theme_selection->SetStringSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name);
// std::function = avoid error on msvc
theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, function<void(wxEvent&)>([theme_selection](wxEvent&)
theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, std::function<void(wxEvent&)>([theme_selection](wxEvent&)
{
SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name = theme_selection->GetStringSelection();
main_frame->InitBitmaps();