In C and C++ is there a cross-platform way of yielding a thread?
Something like sched_yield() or Sleep(0)?
Does SDL_Delay(0) always yield or will it return immediately in some implementations?
In C and C++ is there a cross-platform way of yielding a thread? Something
Share
Given that neither C nor C++ (up to C++98) has “threads,” there is no fully cross-platform way for a thread to yield.
In C++0x, there is a function
std::this_thread::yield()that can be called to yield. That will be the portable way for a thread to yield, once people start using the C++0x threads library.