Hi all,

The following requirement is currently encountered in my application: an integrated extension function (implemented in Java using Saxon 9.2) that sometimes needs to be executed as a separate thread, depending on how the user calls this extension function. The result of this extension function will be a NodeInfo. This result should be returned back to the transformation (no matter if it was called in a single or multi-threaded manner).

Basically what is expected (not sure however if also possible) is that at some point during the transformation, I will have our extension function (noted with f below) which needs to be properly handled:
<f name="f1" threaded="no"> f1 will wait for f2 to complete and only then will return
    <f name="f2" threaded="yes">
        <f name="f3" threaded="no"/>   --> f2 waits until f3 completes execution and only then continue with f4
        <f name="f4" threaded="yes"/> --> f4 is executed as a separate thread. f2 will continue execution with <otherstuff/> and will wait for f4 to complete (only then f2 will return)

Because I am lacking the details of how Saxon deals with such a scenario, I would like to ask how this works in the Saxon XSLT processor and, eventually, how to handle this situation accordingly / better / more wisely. Any available hints / posts / articles / code in which such a scenario is presented is highly welcomed.

Thank you in advance!