Support Board
Date/Time: Sun, 24 Nov 2024 20:51:40 +0000
Post From: C++ ThisThread.Sleep Locks Up the Whole Program
[2024-05-07 16:01:28] |
MichaelPPTF - Posts: 69 |
Hello, I am trying to understand how threads work in SC. For example, I have a function that does something like this: #include <thread> #include <chrono> for (int i = 0; i < 100; ++i) { ### do something ###; std::this_thread::sleep_for(std::chrono::milliseconds(100)); } When the code block is executed, the whole program locks up until the execution is complete. How do I identify which thread belongs to which chart so the main Sierra thread isn't affected by the sleep function? |