diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/unittest/test_threading.cpp | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/unittest/test_threading.cpp')
-rw-r--r-- | src/unittest/test_threading.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/unittest/test_threading.cpp b/src/unittest/test_threading.cpp index 76aff3fb0..8d4d814fd 100644 --- a/src/unittest/test_threading.cpp +++ b/src/unittest/test_threading.cpp @@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "threading/semaphore.h" #include "threading/thread.h" -class TestThreading : public TestBase -{ + +class TestThreading : public TestBase { public: TestThreading() { TestManager::registerTestModule(this); } const char *getName() { return "TestThreading"; } @@ -44,11 +44,11 @@ void TestThreading::runTests(IGameDef *gamedef) TEST(testAtomicSemaphoreThread); } -class SimpleTestThread : public Thread -{ +class SimpleTestThread : public Thread { public: SimpleTestThread(unsigned int interval) : - Thread("SimpleTest"), m_interval(interval) + Thread("SimpleTest"), + m_interval(interval) { } @@ -110,6 +110,7 @@ void TestThreading::testStartStopWait() delete thread; } + void TestThreading::testThreadKill() { SimpleTestThread *thread = new SimpleTestThread(300); @@ -133,11 +134,13 @@ void TestThreading::testThreadKill() delete thread; } -class AtomicTestThread : public Thread -{ + +class AtomicTestThread : public Thread { public: AtomicTestThread(std::atomic<u32> &v, Semaphore &trigger) : - Thread("AtomicTest"), val(v), trigger(trigger) + Thread("AtomicTest"), + val(v), + trigger(trigger) { } @@ -154,6 +157,7 @@ private: Semaphore &trigger; }; + void TestThreading::testAtomicSemaphoreThread() { std::atomic<u32> val; @@ -176,3 +180,4 @@ void TestThreading::testAtomicSemaphoreThread() UASSERT(val == num_threads * 0x10000); } + |