Shows how to use xtd::threading::tasks:task class.
#include <xtd/xtd>
class example {
public:
static auto main() {
for (auto counter = 1; counter <= 5; counter++)
console::write_line("counter = {}", counter);
});
auto string_result_task = task<string>::run(
delegate_ {
return "This is a string result";
});
task<>::wait_all(counter_task, string_result_task);
console::write_line(string_result_task.result());
console::write_line("[task {0}] Run this action in parallel!", task<>::current_id());
};
parallel::invoke(parallel_action, parallel_action, parallel_action, parallel_action, parallel_action, parallel_action);
}
};
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:1018
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:278