Added check if thraeding is running before executing start thread.

This commit is contained in:
Robert Osfield
2018-03-25 12:13:50 +01:00
parent 6b037372b6
commit 862c36a08b
2 changed files with 11 additions and 2 deletions

View File

@@ -603,6 +603,12 @@ bool Thread::isRunning()
//
int Thread::start() {
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
if (pd->isRunning())
{
return 0;
}
int status;
pthread_attr_t thread_attr;
@@ -612,8 +618,6 @@ int Thread::start() {
return status;
}
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
//-------------------------------------------------------------------------
// Set the stack size if requested, but not less than a platform reasonable
// value.