coldfusioncfmlcfthreadcfexecute

Is cfexecute timeout=0 as good as cfthread action=run if no output needed?


Looking at some legacy code and the programmer in question uses:

<cfthread action="run">
    <cfexecute name="c:\myapp.exe" timeout="30">
</cfthread>

Can one safely replace the code above with this?

<cfexecute name="c:\myapp.exe" timeout="0">

Is CF going to spawn up a thread in the code above anyway? And is the thread going to be counted towards "Maximum number of threads available for CFTHREAD"?


Solution

  • If the intent is to have a non-blocking flow of the code, then you can safely replace the earlier code with yours.

    In my understanding, CF is not creating a thread when it gets a timeout="0". It must be just calling the exe (which creates a new process on server) and never wait for the process to reply. So, nothing is added to the thread limit count.