diff --git a/src/util.h b/src/util.h index 9922ba82a..8588201da 100644 --- a/src/util.h +++ b/src/util.h @@ -623,7 +623,10 @@ inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=fa return (pthread_t)0; } if (!fWantHandle) + { + pthread_detach(hthread); return (pthread_t)-1; + } return hthread; }