NJ-1399 "omx proxy crash"
diff --git a/codecs_v2/omx/omx_proxy/src/pv_omx_interface_proxy.cpp b/codecs_v2/omx/omx_proxy/src/pv_omx_interface_proxy.cpp
index 9e93891..503dca2 100644
--- a/codecs_v2/omx/omx_proxy/src/pv_omx_interface_proxy.cpp
+++ b/codecs_v2/omx/omx_proxy/src/pv_omx_interface_proxy.cpp
@@ -129,7 +129,7 @@
if (nreserve2 > 0)
{
iCommandQueue.reserve(nreserve2);
-// iNotificationQueue.reserve(nreserve2);
+// iNotificationQueue.reserve(nreserve2);
}
//create handler
@@ -181,7 +181,6 @@
}
iNotifier = NULL;
- usleep(200000);
iCounterCrit.Close();
iHandlerQueueCrit.Close();
iNotifierQueueCrit.Close();
@@ -206,7 +205,9 @@
OsclProcStatus::eOsclProcError err;
err = iPVThread.Create((TOsclThreadFuncPtr)pvproxythreadmain_omx,
iStacksize,
- (TOsclThreadFuncArg)this);
+ (TOsclThreadFuncArg)this,
+ Start_on_creation,
+ true);
if (err == OSCL_ERR_NONE)
@@ -250,7 +251,7 @@
//if called under the PV thread, we'll get deadlock..
//so don't allow it.
if (iPVThreadContext.IsSameThreadContext())
- { //Commented to remove oscl tls dependency (OsclError::Panic)
+ { //Commented to remove oscl tls dependency (OsclError::Panic)
return;
}
@@ -277,7 +278,7 @@
//Wait for PV thread to finish up, then it's safe
//to delete the remaining stuff.
if (iExitedSem.Wait() != OsclProcStatus::SUCCESS_ERROR)
- { //Commented to remove oscl tls dependency (OsclError::Panic)
+ { //Commented to remove oscl tls dependency (OsclError::Panic)
return;
}
@@ -318,7 +319,7 @@
if (ext)
ext->iClient->HandleNotification(notice.iMsgId, notice.iMsg);
else
- { //since messages are cleaned up when interfaces
+ { //since messages are cleaned up when interfaces
//get unregistered, we should not get here.
OSCL_ASSERT(NULL != ext);//debug error.
}
diff --git a/oscl/oscl/osclproc/src/oscl_thread.cpp b/oscl/oscl/osclproc/src/oscl_thread.cpp
index f1f1bf2..f600c59 100644
--- a/oscl/oscl/osclproc/src/oscl_thread.cpp
+++ b/oscl/oscl/osclproc/src/oscl_thread.cpp
@@ -39,7 +39,7 @@
OSCL_EXPORT_REF OsclThread::OsclThread()
{
bCreated = false;
-
+ iJoined = false;
}
@@ -62,13 +62,14 @@
* stack_size = Size of the thread stack
* argument = Argument to be passed to thread function
* Thread_State = Enumeration which specifies the state of the thread on creation
- * with values Running and Suspend
+ * with values Running and Suspend
* Return value : eOsclProcError
*/
OSCL_EXPORT_REF OsclProcStatus::eOsclProcError OsclThread::Create(TOsclThreadFuncPtr function_name,
int32 stack_size,
TOsclThreadFuncArg argument,
- OsclThread_State state)
+ OsclThread_State state,
+ bool oIsJoinable)
{
if (stack_size < 0)
return OsclProcStatus::INVALID_PARAM_ERROR;
@@ -96,10 +97,19 @@
pthread_attr_setstacksize(&attr, stack_size);
// Default detachstate attribute to PTHREAD_CREATE_DETACHED state
- int detach_ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ int detach_ret;
+ if (oIsJoinable)
+ {
+ detach_ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+ iJoined = true;
+ }
+ else
+ {
+ detach_ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ }
switch (detach_ret)
{
- case 0: // successful, continue thread creation
+ case 0: // successful, continue thread creation
break;
case EINVAL:
default:
@@ -132,7 +142,7 @@
* just ends the execution of the current thread.
* Input Argument:
* exitcode = Exitcode of the thread. This can be used by other threads to know the
- * exit status of this thread.
+ * exit status of this thread.
* Return value : None
*/
OSCL_EXPORT_REF void OsclThread::Exit(OsclAny* exitcode)
@@ -173,7 +183,7 @@
* exitcode = Exitcode of the thread. This can be used by other threads to know the
- * exit status of this thread.
+ * exit status of this thread.
* Return value : Error code
@@ -187,12 +197,20 @@
return OsclProcStatus::INVALID_OPERATION_ERROR;
{
- //intentionally not implemented.
-
OSCL_UNUSED_ARG(oscl_ExitCode);
bCreated = false;
-
+ if (iJoined)
+ {
+ if (pthread_join(ObjThread, NULL) == 0)
+ {
+ return OsclProcStatus::SUCCESS_ERROR;
+ }
+ else
+ {
+ return OsclProcStatus::OTHER_ERROR;
+ }
+ }
return OsclProcStatus::NOT_IMPLEMENTED;
}
}
diff --git a/oscl/oscl/osclproc/src/oscl_thread.h b/oscl/oscl/osclproc/src/oscl_thread.h
index 3b181ce..b4ad7d3 100644
--- a/oscl/oscl/osclproc/src/oscl_thread.h
+++ b/oscl/oscl/osclproc/src/oscl_thread.h
@@ -98,7 +98,7 @@
* platform-specific default stack size will be used.
* argument = Argument to be passed to thread function
* state = Enumeration which specifies the state of the thread on creation
- * with values Running and Suspend. Note: the Suspend option
+ * with values Running and Suspend. Note: the Suspend option
* may not be available on all platforms. If it is not supported,
* the Create call will return INVALID_PARAM_ERROR.
* @return eOsclProcError
@@ -106,14 +106,15 @@
OSCL_IMPORT_REF OsclProcStatus::eOsclProcError Create(TOsclThreadFuncPtr func,
int32 stack_size,
TOsclThreadFuncArg argument,
- OsclThread_State state = Start_on_creation);
+ OsclThread_State state = Start_on_creation,
+ bool isJoinable = false);
/**
* Exit is a static function which is used to end the current thread. When called it
* just ends the execution of the current thread.
* @param
* exitcode = Exitcode of the thread. This can be used by other threads to know the
- * exit status of this thread.
+ * exit status of this thread.
* @return None
*/
OSCL_IMPORT_REF static void Exit(OsclAny* exitcode);
@@ -225,7 +226,7 @@
TOsclThreadObject ObjThread;
bool bCreated;
-
+ bool iJoined;
};
#endif