Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How can I force thread switching?

by ajl52 (Novice)
on Sep 28, 2013 at 15:41 UTC ( #1056145=note: print w/replies, xml ) Need Help??


in reply to Re: How can I force thread switching?
in thread How can I force thread switching?

I have already explored Time::HiRes since usleep() is defined in this package.

I also attempted to wait for 0 unit of time (second or microsecond) to no avail. The null delay is probably detected somewhere and optimised out.

As stated in the manual, yield() is a no-op on most systems.

Replies are listed 'Best First'.
Re^3: How can I force thread switching? ( sleep 33 milliseconds)
by Anonymous Monk on Sep 28, 2013 at 23:18 UTC

    I also attempted to wait for 0 unit of time (second or microsecond) to no avail. The null delay is probably detected somewhere and optimised out.

    BrowserUk says yield is a mistake (like sleep 0), so sleep more, like 1/2 (or less) of the minimum time period that you believe it will take, like 33 milliseconds -- seems to hold true on win32, good rule of thumb :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056145]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2016-12-04 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (65 votes). Check out past polls.