Created
June 16, 2017 18:56
-
-
Save aliaspooryorik/b3bfb3353d5c43b957893a378dbe974a to your computer and use it in GitHub Desktop.
cfthread scoping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function foo() { | |
var i = 0; | |
local.j = 0; | |
local.cat = 1; | |
var bat = 2; | |
var args = { | |
x=0 | |
}; | |
while(i < 4) { | |
i++; | |
local.j++; | |
args.x++; | |
thread.y = i; | |
thread name="thread_#i#" action="run" args=args cat=local.cat i=i { | |
attributes.cat++; | |
attributes.args.x++; | |
thread.y += 10; | |
logit({ | |
cat: attributes.cat, | |
x: attributes.args.x, | |
i: i | |
}); | |
sleep(2); | |
} | |
} | |
thread action="join"; | |
writeDump(args); | |
writeDump(thread); | |
writeDump(cfthread); | |
} | |
function logit(msg) { | |
writeOutput(serializeJSON(msg)); | |
} | |
foo(); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment