Multithreading, when to yield versus sleep
- by aaa
hello.
To clarify terminology, yield is when thread gives up its time slice.
My platform of interest is POSIX threads, but I think question is general.
Suppose I have consumer/producer pattern. If I want to throttle either consumer or producer, which is better to use, sleep or yield? I am mostly interested in efficiency of using either function.
Thanks