I am trying to use the HTTP Request function but it often can take some time to return the data I am requesting. I am wondering if it is possible to send an HTTP request in a background and then continue on with the script. Later when the data is needed I could check to see if it is returned and then either continue on or wait for it to be returned. If this is possible I could parallelized multiple request that are needed instead of running them in serial.
I have never tried this myself but JSL has a "Schedule()" command that can create an independent thread. However, you cannot create more than 1 thread. So, in your case the HTTP request can be sent to that thread but they will still run in series.
Update: See Craig Hales' reply below. Apparently, commands scheduled this way only run when JMP is idle and the commands still run in the foreground. I didn't have a good example to prototype something before I replied. Sorry if I caused any confusion.
Another approach could be that you run multiple instances of JMP by using the "Run Program()" command. I believe these can be made to run without waiting for the external program to finish executing. I tried this before but never for multi-threading. You just gave me an idea that I want to try now!
I don't think either of these solutions are ideal but they probably will improve your script's run time. The first one is easier to implement, the second will require some rearchitecting of your code and you have to deal with starting and quitting JMP.
What we see of the real world is not the unvarnished real world but a model of the real world, constructed so it is useful for dealing with the real world. —Richard Dawkins