19 #include "../../include/ecl/threads/thread.hpp" 25 std::cout <<
"A::f()" << std::endl;
27 void g(
const int &i) {
28 std::cout <<
"A::g(" << i <<
")" << std::endl;
37 for (
int j = 0; j < 3; ++j ) {
38 std::cout <<
" Nullary Function Object: " << i << std::endl;
43 std::cout <<
" Nullary Function Object: finished." << std::endl;
49 for (
int i = 0; i < 5; ++i ) {
52 std::cout <<
" d(): " << i << std::endl;
54 std::cout <<
" d(): finished" << std::endl;
57 std::cout <<
" d(): callback function" << std::endl;
61 for (
int i = 0; i < 3; ++i) {
62 std::cout <<
"f(): " << i << std::endl;
66 void g(
const int &i) {
67 for (
int j = 0; j < 3; ++j) {
68 std::cout <<
"g(" << i <<
")" << std::endl;
73 ecl::Thread thread_deconstruct(
d);
78 std::cout << std::endl;
79 std::cout <<
"***********************************************************" << std::endl;
80 std::cout <<
" Thread Function Type" << std::endl;
81 std::cout <<
"***********************************************************" << std::endl;
82 std::cout << std::endl;
85 ecl::Thread thread_f1(
f);
99 std::cout << std::endl;
100 std::cout <<
"***********************************************************" << std::endl;
101 std::cout <<
" Cancel" << std::endl;
102 std::cout <<
"***********************************************************" << std::endl;
103 std::cout << std::endl;
108 if (!thread.isRunning()) {
109 std::cout <<
"Abnormal #1" << std::endl;
112 if (thread.isRunning()) {
113 std::cout <<
"Abnormal #2" << std::endl;
116 if (thread.isRunning()) {
117 std::cout <<
"Abnormal #3" << std::endl;
120 std::cout << std::endl;
121 std::cout <<
"***********************************************************" << std::endl;
122 std::cout <<
" Deconstruct" << std::endl;
123 std::cout <<
"***********************************************************" << std::endl;
124 std::cout << std::endl;
129 std::cout << std::endl;
130 std::cout <<
"***********************************************************" << std::endl;
131 std::cout <<
" Nullary Function Objects" << std::endl;
132 std::cout <<
"***********************************************************" << std::endl;
133 std::cout << std::endl;
136 ecl::Thread thread_f8(function_object_1);
138 ecl::Thread thread_f9(
ecl::ref(function_object_1));
143 std::cout << std::endl;
144 std::cout <<
"***********************************************************" << std::endl;
145 std::cout <<
" Delayed Start" << std::endl;
146 std::cout <<
"***********************************************************" << std::endl;
147 std::cout << std::endl;
151 ecl::Thread thread1, thread2, thread3, thread4;
153 thread2.start(function_object_2);
162 std::cout << std::endl;
163 std::cout <<
"***********************************************************" << std::endl;
164 std::cout <<
" Passed" << std::endl;
165 std::cout <<
"***********************************************************" << std::endl;
166 std::cout << std::endl;
ReferenceWrapper< T > ref(T &wrapped_object)
NullaryFreeFunction< R > generateFunctionObject(R(*function)())