Now threads work.  All the data is sorted in threads and the threads return the data successfully to main.  The only code left is to combine all the arrays returned by threads to main into a single file.