diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-10-08 12:32:49 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-10-08 12:32:49 +0200 |
commit | cfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (patch) | |
tree | 56cb8849a5df91b19b72fd4f48c79c343cd9bc5e /sanei/sanei_thread.c | |
parent | ba8d09abe681600aad991f4a75e904615b7ed29f (diff) |
Imported Upstream version 1.0.25upstream/1.0.25
Diffstat (limited to 'sanei/sanei_thread.c')
-rw-r--r-- | sanei/sanei_thread.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sanei/sanei_thread.c b/sanei/sanei_thread.c index fd58af2..8db4a21 100644 --- a/sanei/sanei_thread.c +++ b/sanei/sanei_thread.c @@ -512,11 +512,15 @@ sanei_thread_waitpid( SANE_Pid pid, int *status ) DBG(2, "* result = %d (%p)\n", stat, (void*)status ); result = pid; } - /* call detach in any case to make sure that the thread resources - * will be freed, when the thread has terminated - */ - DBG(2, "* detaching thread(%ld)\n", pid ); - pthread_detach((pthread_t)pid); + if ( EDEADLK == rc ) { + if ( (pthread_t)pid != pthread_self() ) { + /* call detach in any case to make sure that the thread resources + * will be freed, when the thread has terminated + */ + DBG(2, "* detaching thread(%ld)\n", pid ); + pthread_detach((pthread_t)pid); + } + } if (status) *status = stat; |