ASSERT_MAIN_THREAD() cleanups.

This commit is contained in:
Casey Langen 2020-10-24 13:14:42 -07:00
parent 47739cb322
commit 2989870580
3 changed files with 9 additions and 18 deletions

View File

@ -17,7 +17,8 @@ include(CheckAtomic)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-unused-result -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -frtti -fexceptions")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -g -frtti -fexceptions")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
# enable for additional memory checking with fsanitize
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -fsanitize=address,undefined")

View File

@ -36,12 +36,6 @@
#include <musikcore/audio/Buffer.h>
#define DEBUG 0
#if DEBUG > 0
#include <iostream>
#endif
#ifdef WIN32
#define CopyFloat(dst, src, num) CopyMemory(dst, src, (num) * sizeof(float))
#else

View File

@ -59,20 +59,16 @@ static Window* focused = nullptr;
static MessageQueue messageQueue;
static std::shared_ptr<INavigationKeys> keys;
#ifndef WIN32
#if DEBUG
static int64_t mainThreadId = reinterpret_cast<int64_t>(pthread_self());
#define ASSERT_MAIN_THREAD() assert(reinterpret_cast<int64_t>(pthread_self()) == mainThreadId);
#else
#define ASSERT_MAIN_THREAD()
#endif
#else
#if DEBUG
#define ASSERT_MAIN_THREAD()
#else
#ifdef DEBUG
#ifdef WIN32
static DWORD mainThreadId = GetCurrentThreadId();
#define ASSERT_MAIN_THREAD() assert(GetCurrentThreadId() == mainThreadId);
#else
static pthread_t mainThreadId = pthread_self();
#define ASSERT_MAIN_THREAD() assert(pthread_self() == mainThreadId);
#endif
#else
#define ASSERT_MAIN_THREAD()
#endif
const int Window::kLastReservedMessageId = INT_MAX;