#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/list_box>
#include <xtd/threading/thread>
class form_thread :
public form {
public:
form_thread() {
text(
"Form and thread example");
form_closed += [&] {
closed = true;
};
messages.parent(*this);
while (!closed) {
++counter;
messages.begin_invoke([&, counter, thread_name] {
messages.items().push_back(string::format("{}: counter: {}", thread_name, counter));
messages.selected_index(messages.items().size() - 1);
});
}
});
}
}
private:
list_box messages;
bool closed = false;
};
auto main() -> int {
}
static uint32 processor_count()
Gets the number of processors on the current machine.
static thread & current_thread() noexcept
Gets the currently running thread.
static thread start_new(const xtd::threading::thread_start &start)
Create and immedialtely start a xtd::threading::thread with specified method.
static void sleep(int32 milliseconds_timeout)
Suspends the current thread for a specified time.
@ u
The U key.
Definition console_key.hpp:128
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8