I'm looking for the simplest, most straightforward way to implement the following:
- main starts and launches 3 threads
- all 3 tasks process and end in a resulting value (which I need to return somehow?)
- main waits (.join?) on each thread to ensure they have all 3 completed their task
- main somehow gets the value from each thread (3 values)
Then the rest is fairly simple, processes the 3 results and then terminates...
Now, I've been doing some reading and found multiple ideas, like:
- Using Future, but this is for asynch, is this really a good idea when the main thread needs to block waiting for all 3 spawned threads to finsih?
- Passing in an object (to a thread) and then simply having the thread "fill it" with the result
- Somehow using Runnable (not sure how yet).
Anyways - what would be the best, and simplest recommended approach? Thanks,