blob: dad3b88ea5ca823b72851c21d712fe3215e0b761 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/*
* Copyright 2010-2015 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "test.h"
#include <bx/thread.h>
int32_t threadExit0(void*)
{
return 0;
}
int32_t threadExit1(void*)
{
return 1;
}
TEST(thread)
{
bx::Thread th;
CHECK_EQUAL(th.isRunning(), false);
th.init(threadExit0);
CHECK_EQUAL(th.isRunning(), true);
th.shutdown();
CHECK_EQUAL(th.isRunning(), false);
CHECK_EQUAL(th.getExitCode(), 0);
th.init(threadExit1);
CHECK_EQUAL(th.isRunning(), true);
th.shutdown();
CHECK_EQUAL(th.isRunning(), false);
CHECK_EQUAL(th.getExitCode(), 1);
}
|