Fix SDL UI failing to build when C++11 threads are disabled
This commit is contained in:
@@ -131,7 +131,6 @@ option(RTMIDI "RtMidi"
|
|||||||
option(FLUIDSYNTH "FluidSynth" ON)
|
option(FLUIDSYNTH "FluidSynth" ON)
|
||||||
option(MUNT "MUNT" ON)
|
option(MUNT "MUNT" ON)
|
||||||
option(VNC "VNC renderer" OFF)
|
option(VNC "VNC renderer" OFF)
|
||||||
option(CPPTHREADS "C++11 threads" ON)
|
|
||||||
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)
|
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)
|
||||||
option(MINITRACE "Enable Chrome tracing using the modified minitrace library" OFF)
|
option(MINITRACE "Enable Chrome tracing using the modified minitrace library" OFF)
|
||||||
option(GDBSTUB "Enable GDB stub server for debugging" OFF)
|
option(GDBSTUB "Enable GDB stub server for debugging" OFF)
|
||||||
@@ -141,8 +140,10 @@ option(DEBUGREGS486 "Enable debug register opeartion on 486+ CPUs"
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(QT ON)
|
set(QT ON)
|
||||||
|
option(CPPTHREADS "C++11 threads" OFF)
|
||||||
else()
|
else()
|
||||||
option(QT "Qt GUI" ON)
|
option(QT "Qt GUI" ON)
|
||||||
|
option(CPPTHREADS "C++11 threads" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Development branch features
|
# Development branch features
|
||||||
|
@@ -27,9 +27,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||||||
add_compile_definitions(_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE=1 _LARGEFILE64_SOURCE=1)
|
add_compile_definitions(_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE=1 _LARGEFILE64_SOURCE=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(CPPTHREADS)
|
||||||
target_sources(86Box PRIVATE qt/win_thread.c)
|
|
||||||
else()
|
|
||||||
target_sources(86Box PRIVATE thread.cpp)
|
target_sources(86Box PRIVATE thread.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -227,6 +227,10 @@ if(WIN32 AND NOT MINGW)
|
|||||||
target_sources(plat PRIVATE win_opendir.c)
|
target_sources(plat PRIVATE win_opendir.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32 AND NOT CPPTHREADS)
|
||||||
|
target_sources(plat PRIVATE win_thread.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(plat PRIVATE win_serial_passthrough.c win_netsocket.c)
|
target_sources(plat PRIVATE win_serial_passthrough.c win_netsocket.c)
|
||||||
else()
|
else()
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include <86box/plat.h>
|
#include <86box/plat.h>
|
||||||
#include <86box/thread.h>
|
#include <86box/thread.h>
|
||||||
|
|
||||||
struct event_cpp11_ex_t {
|
struct event_cpp11_t {
|
||||||
std::condition_variable cond;
|
std::condition_variable cond;
|
||||||
std::mutex mutex;
|
std::mutex mutex;
|
||||||
bool state = false;
|
bool state = false;
|
||||||
@@ -82,14 +82,14 @@ thread_close_mutex(mutex_t *_mutex)
|
|||||||
event_t *
|
event_t *
|
||||||
thread_create_event()
|
thread_create_event()
|
||||||
{
|
{
|
||||||
auto ev = new event_cpp11_ex_t;
|
auto ev = new event_cpp11_t;
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
thread_wait_event(event_t *handle, int timeout)
|
thread_wait_event(event_t *handle, int timeout)
|
||||||
{
|
{
|
||||||
auto event = reinterpret_cast<event_cpp11_ex_t *>(handle);
|
auto event = reinterpret_cast<event_cpp11_t *>(handle);
|
||||||
auto lock = std::unique_lock<std::mutex>(event->mutex);
|
auto lock = std::unique_lock<std::mutex>(event->mutex);
|
||||||
|
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
@@ -112,7 +112,7 @@ thread_wait_event(event_t *handle, int timeout)
|
|||||||
void
|
void
|
||||||
thread_set_event(event_t *handle)
|
thread_set_event(event_t *handle)
|
||||||
{
|
{
|
||||||
auto event = reinterpret_cast<event_cpp11_ex_t *>(handle);
|
auto event = reinterpret_cast<event_cpp11_t *>(handle);
|
||||||
{
|
{
|
||||||
auto lock = std::unique_lock<std::mutex>(event->mutex);
|
auto lock = std::unique_lock<std::mutex>(event->mutex);
|
||||||
event->state = true;
|
event->state = true;
|
||||||
@@ -123,7 +123,7 @@ thread_set_event(event_t *handle)
|
|||||||
void
|
void
|
||||||
thread_reset_event(event_t *handle)
|
thread_reset_event(event_t *handle)
|
||||||
{
|
{
|
||||||
auto event = reinterpret_cast<event_cpp11_ex_t *>(handle);
|
auto event = reinterpret_cast<event_cpp11_t *>(handle);
|
||||||
auto lock = std::unique_lock<std::mutex>(event->mutex);
|
auto lock = std::unique_lock<std::mutex>(event->mutex);
|
||||||
event->state = false;
|
event->state = false;
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ thread_reset_event(event_t *handle)
|
|||||||
void
|
void
|
||||||
thread_destroy_event(event_t *handle)
|
thread_destroy_event(event_t *handle)
|
||||||
{
|
{
|
||||||
auto event = reinterpret_cast<event_cpp11_ex_t *>(handle);
|
auto event = reinterpret_cast<event_cpp11_t *>(handle);
|
||||||
delete event;
|
delete event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user