forked from cppfastio/fast_io
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththread.cc
More file actions
37 lines (33 loc) · 1.08 KB
/
thread.cc
File metadata and controls
37 lines (33 loc) · 1.08 KB
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
#include <fast_io.h>
int main()
{
auto t = ::fast_io::native_thread{[](int param)
#if __cpp_static_call_operator >= 2020207L
static
#endif
noexcept {
::fast_io::println("the param is: ", param);
#ifdef _WIN32
#ifdef _WIN32_WINDOWS
::fast_io::println("the child thread id is: ", ::fast_io::this_thread::get_id());
#else
::fast_io::println("the child thread id is: ", ::fast_io::mnp::pointervw(::fast_io::this_thread::get_id()));
#endif
#else
::fast_io::println("the child thread id is: ", ::fast_io::this_thread::get_id());
#endif
// ::fflush(stdout);
::fast_io::this_thread::sleep_for(::fast_io::unix_timestamp{.seconds = 1});
},
5};
t.join();
#ifdef _WIN32
#ifdef _WIN32_WINDOWS
::fast_io::println("the parent thread id is: ", ::fast_io::this_thread::get_id());
#else
::fast_io::println("the parent thread id is: ", ::fast_io::mnp::pointervw(::fast_io::this_thread::get_id()));
#endif
#else
::fast_io::println("the parent thread id is: ", ::fast_io::this_thread::get_id());
#endif
}