summaryrefslogtreecommitdiff
path: root/sanei/sanei_thread.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-09-27 08:20:20 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-09-27 08:20:20 +0200
commite94622c319e4307617b202f19d3ec05b21a9bb49 (patch)
treec5ddf44352b9bd47aeb3eb432ba79638079efe25 /sanei/sanei_thread.c
parent6f2255c9648b175d51e2c8e5e9670557f9dc4ee1 (diff)
merge to 1.0.25+git20150927
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;