Another possibility is to use a future to return a value from the thread function. This will not work with a static array, because you cannot return a static array from a function, but it will work...