diff options
author | 2017-12-01 13:22:27 +0100 | |
---|---|---|
committer | 2017-12-01 13:22:27 +0100 | |
commit | 39176274946d70ff520f265dee8fbd16d5fe0000 (patch) | |
tree | 318801d93146752050c9a492654ae3738820e3b9 /3rdparty/bx/tests/thread_test.cpp | |
parent | 6829ecb3b037d6bfbe0b84e818d17d712f71bce6 (diff) |
Updated GENie, BGFX, BX, added BIMG since it is separated now, updated all shader binaries and MAME part of code to support new interfaces [Miodrag Milanovic]
Diffstat (limited to '3rdparty/bx/tests/thread_test.cpp')
-rw-r--r-- | 3rdparty/bx/tests/thread_test.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/3rdparty/bx/tests/thread_test.cpp b/3rdparty/bx/tests/thread_test.cpp index 8d099311835..713781956fb 100644 --- a/3rdparty/bx/tests/thread_test.cpp +++ b/3rdparty/bx/tests/thread_test.cpp @@ -6,17 +6,37 @@ #include "test.h" #include <bx/thread.h> -int32_t threadExit0(void*) +bx::DefaultAllocator s_allocator; +bx::MpScUnboundedBlockingQueue<void> s_mpsc(&s_allocator); + +int32_t threadExit0(bx::Thread* _thread, void*) { - return 0; + _thread->pop(); + + s_mpsc.push(reinterpret_cast<void*>(uintptr_t(0x1300) ) ); + + return bx::kExitSuccess; +} + +int32_t threadExit1(bx::Thread* _thread, void*) +{ + BX_UNUSED(_thread); + + s_mpsc.push(reinterpret_cast<void*>(uintptr_t(0x89) ) ); + + return bx::kExitFailure; } -int32_t threadExit1(void*) +TEST_CASE("Semaphore", "") { - return 1; + bx::Semaphore sem; + REQUIRE(!sem.wait(10) ); + + sem.post(1); + REQUIRE(sem.wait() ); } -TEST_CASE("thread", "") +TEST_CASE("Thread", "") { bx::Thread th; @@ -24,6 +44,7 @@ TEST_CASE("thread", "") th.init(threadExit0); REQUIRE(th.isRunning() ); + th.push(NULL); th.shutdown(); REQUIRE(!th.isRunning() ); @@ -36,3 +57,13 @@ TEST_CASE("thread", "") REQUIRE(!th.isRunning() ); REQUIRE(th.getExitCode() == 1); } + +TEST_CASE("MpScUnboundedBlockingQueue", "") +{ + void* p0 = s_mpsc.pop(); + void* p1 = s_mpsc.pop(); + + uintptr_t result = uintptr_t(p0) | uintptr_t(p1); + + REQUIRE(result == 0x1389); +} |