I am in school and have been given the problem to use multiple threads and mutex to get two random numbers and in the second thread, produce the greates common factor. And, I need to have this happen 10 times. I have tried and was successful in creating most of the problem but when I attempt to use a mutex, it runs thread 1 (main function) twice before releasing the mutex. Then it runs thread two 7 times before going back to thread 1 for two more times then the last 3 times for thread 2 and finally the remaining times in thread 1. I've tried setting the second parameter in the creation of the mutex to true and thread 2 never runs at all. any help would be appreciated.