mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Added BX_CONFIG_SUPPORTS_THREADING.
This commit is contained in:
@@ -165,4 +165,8 @@
|
||||
# define BX_CONFIG_SEMAPHORE_PTHREAD (BX_PLATFORM_OSX|BX_PLATFORM_IOS)
|
||||
#endif // BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
|
||||
#ifndef BX_CONFIG_SUPPORTS_THREADING
|
||||
# define BX_CONFIG_SUPPORTS_THREADING !BX_PLATFORM_EMSCRIPTEN
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_MACROS_H_HEADER_GUARD
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "cpu.h"
|
||||
#include "sem.h"
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#if BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_ANDROID || BX_PLATFORM_OSX
|
||||
# include <pthread.h>
|
||||
#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
|
||||
@@ -130,4 +132,6 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_MUTEX_H_HEADER_GUARD
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "bx.h"
|
||||
#include "mutex.h"
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#if BX_PLATFORM_POSIX
|
||||
# include <errno.h>
|
||||
# include <semaphore.h>
|
||||
@@ -222,4 +224,6 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_SEM_H_HEADER_GUARD
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace bx
|
||||
Node* m_last;
|
||||
};
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
template<typename Ty>
|
||||
class SpScUnboundedQueueMutex
|
||||
{
|
||||
@@ -147,13 +148,15 @@ namespace bx
|
||||
bx::LwMutex m_mutex;
|
||||
std::list<Ty*> m_queue;
|
||||
};
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#if BX_CONFIG_SPSCQUEUE_USE_MUTEX
|
||||
#if BX_CONFIG_SPSCQUEUE_USE_MUTEX && BX_CONFIG_SUPPORTS_THREADING
|
||||
# define SpScUnboundedQueue SpScUnboundedQueueMutex
|
||||
#else
|
||||
# define SpScUnboundedQueue SpScUnboundedQueueLf
|
||||
#endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
template <typename Ty>
|
||||
class SpScBlockingUnboundedQueue
|
||||
{
|
||||
@@ -196,6 +199,7 @@ namespace bx
|
||||
Semaphore m_count;
|
||||
SpScUnboundedQueue<void> m_queue;
|
||||
};
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
} // namespace bx
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "sem.h"
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
namespace bx
|
||||
{
|
||||
typedef int32_t (*ThreadFn)(void* _userData);
|
||||
@@ -222,4 +224,6 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_THREAD_H_HEADER_GUARD
|
||||
|
||||
@@ -480,6 +480,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"$(EMSCRIPTEN)/system/include/libc",
|
||||
}
|
||||
buildoptions {
|
||||
"-Wno-unknown-warning-option", -- Linux Emscripten doesn't know about no-warn-absolute-paths...
|
||||
"-Wno-warn-absolute-paths",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user