From ef5a60731cb5208cc15819fd515a87e28d15f5d1 Mon Sep 17 00:00:00 2001 From: ChenHengming Date: Fri, 25 Jan 2008 15:24:28 +0000 Subject: [PATCH] [mpp_thread]: fix invalid thread_join when thread is not started git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@193 6e48237b-75ef-9749-8fc9-41990f28c85a --- osal/mpp_thread.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osal/mpp_thread.cpp b/osal/mpp_thread.cpp index 12fbcecb..35987452 100644 --- a/osal/mpp_thread.cpp +++ b/osal/mpp_thread.cpp @@ -61,14 +61,16 @@ void MppThread::start() void MppThread::stop() { - mStatus = MPP_THREAD_STOPPING; - signal(); + if (MPP_THREAD_UNINITED != mStatus) { + mStatus = MPP_THREAD_STOPPING; + signal(); - void *dummy; - pthread_join(mThread, &dummy); - thread_dbg(MPP_THREAD_DBG_FUNCTION, "mThread %p mContext %p destroy success\n", - mFunction, mContext); + void *dummy; + pthread_join(mThread, &dummy); + thread_dbg(MPP_THREAD_DBG_FUNCTION, "mThread %p mContext %p destroy success\n", + mFunction, mContext); - mStatus = MPP_THREAD_UNINITED; + mStatus = MPP_THREAD_UNINITED; + } }