in reply to Re^4: Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix
in thread Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix

What I was doubtful about, was if adding a yield() before or after the the delay would aid the OS somehow in yielding more CPU time to other threads of the same parent PID

Sleeping already totally frees the CPU. I don't see how you could free it more than totally.

But if not, what is the yield() call there for?

When you have a CPU intensive task and you wish to give a chance to someone else to execute? It could improve the responsiveness of UI threads?

  • Comment on Re^5: Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix