Hi guys. I tried finding the answer to the following question myself, but I couldn’t find a clear, definitive answer.
If I define a cffunction and its code only uses the arguments passed into it (arguments-scope variables), and some working variables it creates using the “var” keyword (local-scope variables) and those working variables are made solely by transforming/formatting the argument values… is that cffunction threadsafe?
Meaning can I launch a bunch of simultaneous cfthreads that all call that cffunction, and have no data clashes or race conditions between different simultaneous invocations of the cffunction by different simutaneously-running cfthreads?
I’m 95% sure this IS indeed threadsafe, because each and every invocation of the cffunction should have its very own private version of the “arguments” scope variables and the “local” scope variables created for it, separate from those of any/all other running invocations of the cffunction, and the “local” scope (var keyword) working variables values’ will be constructed using only the arguments that were passed in… so overall, assuming the arguments and return values are passed by value not reference (meaning they’re all either primitive types or complex types wrapped in Duplicate()), then this should be a “shared nothing” situation, which is inherently threadsafe.
Can someone confirm? Thanks!
OS: Linux
Java Version: 11.0.11
Tomcat Version: 8.0.36
Lucee Version: 6.1.0.243