Don't detach unconditionally after pthread_join()

merge-requests/1/head
Olaf Meeuwissen 2015-09-12 15:20:21 +09:00 zatwierdzone przez m. allan noah
rodzic 20a0ed547e
commit eb54dbf200
1 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -512,11 +512,15 @@ sanei_thread_waitpid( SANE_Pid pid, int *status )
DBG(2, "* result = %d (%p)\n", stat, (void*)status ); DBG(2, "* result = %d (%p)\n", stat, (void*)status );
result = pid; result = pid;
} }
/* call detach in any case to make sure that the thread resources if ( EDEADLK == rc ) {
* will be freed, when the thread has terminated if ( (pthread_t)pid != pthread_self() ) {
*/ /* call detach in any case to make sure that the thread resources
DBG(2, "* detaching thread(%ld)\n", pid ); * will be freed, when the thread has terminated
pthread_detach((pthread_t)pid); */
DBG(2, "* detaching thread(%ld)\n", pid );
pthread_detach((pthread_t)pid);
}
}
if (status) if (status)
*status = stat; *status = stat;