Enjoy BYOND? Contribute today!
What does spawn(-1) do?
Feb 26 2012, 10:31 am
Just wondering what spawn(-1) does.
Feb 26 2012, 10:33 am
"If delay is negative, the spawned code is executed before continuing in the main code."
So it creates a virtual thread, runs the spawned code first (until it hits a sleep of some sort) and then continues the original thread. One other effect is this:
"Any vars you have defined in the proc itself, including arguments, will be copied between the spawned code and the code that runs right away. This means that if one part modifies one of those vars, the other part will not see that change. Changes made to objects, lists, datums, etc. however will be visible to both code blocks. "
Feb 26 2012, 10:35 am
Don't see how I missed that in the reference... thanks!
Copyright © 2013 BYOND. All rights reserved.
Terms of Service