mamke status a member so that we aren't return the address of a local variable

This commit is contained in:
Isaac Connor
2016-03-31 14:43:22 -04:00
parent e9ed046361
commit ecce87b779
2 changed files with 9 additions and 9 deletions

View File

@@ -253,7 +253,7 @@ void *Thread::mThreadFunc( void *arg )
Debug( 2, "Invoking thread" );
Thread *thisPtr = (Thread *)arg;
void *status = 0;
thisPtr->status = 0;
try
{
thisPtr->mThreadMutex.lock();
@@ -261,19 +261,18 @@ void *Thread::mThreadFunc( void *arg )
thisPtr->mThreadCondition.signal();
thisPtr->mThreadMutex.unlock();
thisPtr->mRunning = true;
int run=(thisPtr->run());
status = (void *)&run;
thisPtr->status = thisPtr->run();
thisPtr->mRunning = false;
Debug( 2, "Exiting thread, status %p", status );
Debug( 2, "Exiting thread, status %p", (void *)&(thisPtr->status) );
return (void *)&(thisPtr->status);
}
catch ( const ThreadException &e )
{
Error( "%s", e.getMessage().c_str() );
thisPtr->mRunning = false;
status = (void *)-1;
Debug( 2, "Exiting thread after exception, status %p", status );
Debug( 2, "Exiting thread after exception, status %p", (void *)-1 );
return (void *)-1;
}
return( status );
}
void Thread::start()