#include <xtd/collections/generic/list>
#include <xtd/threading/auto_reset_event>
#include <xtd/threading/thread>
#include <xtd/console>
#include <xtd/startup>
namespace auto_reset_event_example {
class program {
public:
static auto main() {
"The threads wait on auto_reset_event #1, which was created\r\n"
"in the signaled state, so the first thread is released.\r\n"
"This puts auto_reset_event #1 into the unsignaled state.");
for (auto index = 1; index < 4; ++index) {
threads.emplace_back(thread_proc);
threads.back().name(string::format("Thread_{}", index));
threads.back().start();
}
for (auto index = 0; index < 2; ++index) {
event_1.set();
}
for (
int i = 0;
i < 3;
i++) {
event_2.set();
}
}
static void thread_proc() {
event_1.wait_one();
event_2.wait_one();
}
private:
};
}
startup_(auto_reset_event_example::program::main);
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
static xtd::string read_line()
Reads the next line of characters from the standard input stream.
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
Represents a thread synchronization event that, when signaled, resets automatically after releasing a...
Definition auto_reset_event.hpp:36
static thread & current_thread() noexcept
Gets the currently running thread.
static void sleep(int32 milliseconds_timeout)
Suspends the current thread for a specified time.
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:167
@ i
The I key.
Definition console_key.hpp:104
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8