sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
main.cpp
1
#include <cstdio>
2
#include <cstring>
3
4
extern
"C"
{
5
#include <
kernel.h
>
6
}
7
8
#include <cstdio>
9
#include <future>
10
#include <thread>
11
12
extern
"C"
int
kputs(
char
*s);
13
14
/* A program must never return from main on the rig: that reboots the console. */
15
static
int
rig_failed;
16
static
int
rig_kputs(
char
*s) {
17
if
(strstr(s,
": FAIL"
)) rig_failed = 1;
18
return
kputs(s);
19
}
20
#define kputs rig_kputs
21
22
static
int
test_main() {
23
std::promise<int> prom;
24
std::future<int> fut = prom.get_future();
25
26
std::thread worker([&prom]() { prom.set_value(21 * 2); });
27
28
int
result = fut.get();
29
worker.join();
30
31
if
(result != 42) {
32
kputs((
char
*)
"cxx-promise: FAIL wrong result\n"
);
33
return
1;
34
}
35
36
kputs((
char
*)
"cxx-promise: PASS\n"
);
37
return
0;
38
}
39
40
int
main() {
41
int
result = test_main();
42
printf(
"[ps2rig] exit=%d\n"
, (result || rig_failed) ? 1 : 0);
43
SleepThread();
44
return
0;
45
}
kernel.h
tests
cxx-promise
src
main.cpp
Generated by
1.18.0