-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_threads.cc
41 lines (40 loc) · 987 Bytes
/
test_threads.cc
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
39
40
41
#include "thread.h"
#include "pair.h"
int main(int argc, char* argv[])
{
t_engine<t_type>::t_options options;
if (argc > 1) std::sscanf(argv[1], "%zu", &options.v_collector__threshold);
options.v_verbose = true;
t_engine_with_threads engine(options);
return [&]() RECYCLONE__NOINLINE
{
auto RECYCLONE__SPILL p = f_new<t_pair>();
::t_thread* RECYCLONE__SPILL ts[10];
for (size_t i = 0; i < 10; ++i) {
ts[i] = engine.f_start_thread([p, i]
{
f_epoch_point<t_type>();
f_epoch_region<t_type>([&]
{
std::printf("%zu\n", i);
});
for (size_t j = 0; j < 100; ++j) {
p->v_head = f_new<t_pair>(f_new<t_symbol>(std::to_string(i)), p->v_head);
f_epoch_point<t_type>();
}
});
f_epoch_point<t_type>();
}
for (auto t : ts) {
engine.f_join(t);
f_epoch_point<t_type>();
}
auto s = f_string(p->v_head);
f_epoch_region<t_type>([&]
{
std::printf("%s\n", s.c_str());
});
engine.f_join_foregrounds();
return 0;
}();
}