Shows how to use xtd::threading::event_wait_handle class.
#include <xtd/threading/event_wait_handle>
#include <xtd/threading/interlocked>
#include <xtd/threading/thread>
#include <xtd/console>
#include <xtd/startup>
class example {
private:
inline static int64 thread_count = 0;
public:
static void main() {
for (
auto i = 0;
i <= 4;
i++) {
threads_[
i] =
thread {thread_proc};
}
}
}
for(
auto i = 0;
i <= 4;
i++) {
threads_[
i] =
thread {thread_proc};
}
}
}
private:
static void thread_proc(
std::any data) {
clear_count.set();
}
inline static std::array<thread, 5> threads_;
};