implicit loop in preemptive thread produces unexpected error in URLRequest

I suspect the explanation for this has something to do with complexities of memory management, but I'm curious.

I have a threadsafe string function that uses URLRequest.

If I write

textwave=strfunc(textwave[p])

URLRequest is unhappy and sets an error for each point of textwave. But this works without error:

for(i=0;i<numpnts(textwave);i+=1)
    textwave[i]=strfunc(textwave[i])
endfor

 

Not sure if this is relevant but automatic threading divides the dest wave into chunks, one for each thread, so the index is all over the place compared with your loop that increments monotonically.

 

In reply to by Larry Hutchinson

The indexing shouldn't matter in this case.

Hmm, now it seems to work both with implicit and actual loop. I really thought that I didn't change anything other than adding a loop...  but it looks like I have to retract my comment. Debugging with print statements can get tricky!

FWIW, the error thrown by URLRequest was V_flag = 8305. I think maybe the /TIME flag for URLRequest was wrongly set. Anyhow, now the code works and has no unexpected behaviour.

The /TIME flag is valid if the value is [0, 2147483). If you're using a variable instead of a numeric literal for the timeout, perhaps your variable got set to NaN or Inf or something else out of range.