MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / main

Function main

OpenHD/ohd_common/test/test_openhd_async.cpp:27–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include "openhd_util_async.h"
26
27int main(int argc, char *argv[]) {
28 openhd::AsyncHandle::instance();
29 openhd::AsyncHandle::instance().execute_async("LONG_TASK", []() {
30 std::this_thread::sleep_for(std::chrono::seconds(10000));
31 });
32 openhd::AsyncHandle::instance().execute_async("QUICK_TASK", []() {
33 std::this_thread::sleep_for(std::chrono::seconds(1));
34 });
35 while (openhd::AsyncHandle::instance().get_n_current_tasks()) {
36 // Wait until all tasks are finished
37 std::this_thread::sleep_for(std::chrono::seconds(1));
38 }
39 return 0;
40}

Callers

nothing calls this directly

Calls 2

execute_asyncMethod · 0.80
get_n_current_tasksMethod · 0.80

Tested by

no test coverage detected