Re: [AD] small bug in uthreads.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Peter Wang wrote:
 static void bg_man_pthreads_exit(void)
 {
-   pthread_cancel(thread);
-   pthread_join(thread, NULL);
-   pthread_mutex_destroy(&cli_mutex);
-   pthread_cond_destroy(&cli_cond);
+   if (thread) {
+      pthread_cancel(thread);
+      pthread_join(thread, NULL);
+      pthread_mutex_destroy(&cli_mutex);
+      pthread_cond_destroy(&cli_cond);
+      thread = 0;
+   }
+
+   ASSERT(thread == 0);
 }

You realize that ASSERT will never fail.. If thread was initially non-0 it gets closed and set to 0, and if it was 0, it goes untouched.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/