1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Remove Thread::kill() and related unittest (#10317)

Closes: #6065
This commit is contained in:
Sebastien Marie 2020-09-10 12:19:18 +02:00 committed by GitHub
parent 0683bea283
commit 3fb1f45301
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 65 deletions

View file

@ -31,7 +31,6 @@ public:
void runTests(IGameDef *gamedef);
void testStartStopWait();
void testThreadKill();
void testAtomicSemaphoreThread();
};
@ -40,7 +39,6 @@ static TestThreading g_test_instance;
void TestThreading::runTests(IGameDef *gamedef)
{
TEST(testStartStopWait);
TEST(testThreadKill);
TEST(testAtomicSemaphoreThread);
}
@ -111,29 +109,6 @@ void TestThreading::testStartStopWait()
}
void TestThreading::testThreadKill()
{
SimpleTestThread *thread = new SimpleTestThread(300);
UASSERT(thread->start() == true);
// kill()ing is quite violent, so let's make sure our victim is sleeping
// before we do this... so we don't corrupt the rest of the program's state
sleep_ms(100);
UASSERT(thread->kill() == true);
// The state of the thread object should be reset if all went well
UASSERT(thread->isRunning() == false);
UASSERT(thread->start() == true);
UASSERT(thread->stop() == true);
UASSERT(thread->wait() == true);
// kill() after already waiting should fail.
UASSERT(thread->kill() == false);
delete thread;
}
class AtomicTestThread : public Thread {
public: