Can someone provide a real example of using std::this_thread::yield() in a C ++ application?
std::this_thread::yield()
I used the output in the std :: lock implementation found here:
http://llvm.org/svn/llvm-project/libcxx/trunk/include/mutex
It turns out that if you lock several locks / mutexes at a time when you cannot get them, you can make the application faster by using the exit before trying to lock / mutexes in a different order.
In this source code, I actually called sched_yield() . But this is only to get the title dependency the way I wanted it. On this platform, std::this_thread::yield() is nothing more than a sched_yield() call:
sched_yield()
http://llvm.org/svn/llvm-project/libcxx/trunk/include/thread