flst / upstream /emscripten /test /pthread /test_pthread_busy_wait.cpp
arudradey's picture
Upload folder using huggingface_hub
00df61d verified
Raw
History Blame Contribute Delete
274 Bytes
#include <atomic>
#include <thread>
#include <cstdio>
int main() {
std::atomic<bool> done(false);
std::thread t([&]{
printf("in thread\n");
done = true;
});
while (!done) {
std::this_thread::yield();
}
t.join();
printf("done\n");
return 0;
}