Login Page - Create Account

Support Board


Date/Time: Fri, 04 Jul 2025 13:39:03 +0000



Post From: C++ ThisThread.Sleep Locks Up the Whole Program

[2024-05-07 16:01:28]
MichaelPPTF - Posts: 70
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?