summaryrefslogtreecommitdiff
path: root/sanei/sanei_thread.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:33:06 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:33:06 +0200
commit24feb9f37f302c006ba51502da817325200e74d0 (patch)
treed4451782449e5fcbae9cbe3778c51a8c6cb3c36d /sanei/sanei_thread.c
parent76b69ebb381d40458339c9940135740797cbd2d4 (diff)
parentcfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (diff)
Merge tag 'upstream/1.0.25'
Upstream version 1.0.25
Diffstat (limited to 'sanei/sanei_thread.c')
-rw-r--r--sanei/sanei_thread.c14
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;