blob: 8d0993118354aed1fb41f9aac10dcfe8ef4df365 (
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-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#include "test.h"
#include <bx/thread.h>
int32_t threadExit0(void*)
{
return 0;
}
int32_t threadExit1(void*)
{
return 1;
}
TEST_CASE("thread", "")
{
bx::Thread th;
REQUIRE(!th.isRunning() );
th.init(threadExit0);
REQUIRE(th.isRunning() );
th.shutdown();
REQUIRE(!th.isRunning() );
REQUIRE(th.getExitCode() == 0);
th.init(threadExit1);
REQUIRE(th.isRunning() );
th.shutdown();
REQUIRE(!th.isRunning() );
REQUIRE(th.getExitCode() == 1);
}
|