Do not create more than one thread for the same thing!
Go back to using this thread:
http://cboard.cprogramming.com/c-programming/153942-sorting-c-language.html