I am sure this is straightforward to many of you, but I am at a loss. I have read the examples, and searched for responses to other inquiries on the topic, but I am stuck. I have a program that has to loop through 511*511 combinations of comparisons to determine two output values (in this case - two character codes from 0 to 255) from a given set of input coordinates in an image. Since the determination of the optimal characters are independent of each other and because the code executes far too slowly I am trying to use additional threads to do that calculation.
I want to be able to do this (not real code, conceptual), x and y are values to send to the thread and I want it to spit back mini and minj. x is from 1 to 320, y is from 1 to 200, mini and minj are from 0 to 255. mini and minj are found at the same time and both variables need to come back
Code: Select all
for y=1 to 200 step 8
for x=1 to 320 step 8
param = threadcreate (x,y)
.... do stuff with the return values ...
threadwait (wait for them all to finish)
... move on ...
I have not used pointers or custom data types, so I would really appreciate some hand holding from a kind soul! In my head it is simple - I just create a thread for each set of characters. Also, does a thread have access to the data in shared arrays? If not, then I am really toast, because it needs to have access to a set of 20 arrays that contain the image, the character sets, etc.?