Skip to content
Snippets Groups Projects
Commit 071bbfbb authored by Mactavish's avatar Mactavish
Browse files

add deadlock solution

parent cc15cb60
Branches
No related tags found
No related merge requests found
......@@ -14,11 +14,11 @@ void shared_print_thread_even(int i) {
}
void shared_print_thread_odd(int i) {
pthread_mutex_lock(&odd_mutex);
pthread_mutex_lock(&even_mutex);
pthread_mutex_lock(&odd_mutex);
printf(" %d ", i);
pthread_mutex_unlock(&even_mutex);
pthread_mutex_unlock(&odd_mutex);
pthread_mutex_unlock(&even_mutex);
}
void shared_print_main(int i) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment