I ended up putting the thread::sleep() in the loop and used 15 milliseconds. After adding this, 99 percent of the time it only attempts to move the the file once before it works. This also works on both of my machines.
int loopCounter = 0;
const int END_LOOP_AFTER_X_ATTEMPTS = 100;
for(; (loopCounter < END_LOOP_AFTER_X_ATTEMPTS) && (Base::getFileHolder().exists()); loopCounter++)
{
Base::getFileHolder().moveToTrash();
Thread::sleep(15);
}
I don’t know what the yield offers, as I’m not entirely sure what it does.
This sounds neat! I’ll fool around with this and see what happens!
I’ve only been using JUCE for about 4 months. It’s so ridiculously large, it’s hard to know what all is possible! Loving it! Definitely will be making a purchase when I’m ready to release some non-open-source stuff!
It’s basically a way for the current thread to give away the rest of its allotted time slot. This will give way to another thread, and the execution of your thread will continue when its turn comes again.