From e94622c319e4307617b202f19d3ec05b21a9bb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 27 Sep 2015 08:20:20 +0200 Subject: merge to 1.0.25+git20150927 --- sanei/sanei_thread.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sanei/sanei_thread.c') 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; -- cgit v1.2.3