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 7e476c6f63
commit 20cbb25cd1
2 changed files with 11 additions and 2 deletions

View File

@ -638,6 +638,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;
@ -647,8 +653,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.

View File

@ -336,6 +336,11 @@ bool Thread::isRunning() {
int Thread::start() {
Win32ThreadPrivateData *pd = static_cast<Win32ThreadPrivateData *> (_prvData);
if (pd->isRunning)
{
return 0;
}
//-------------------------------------------------------------------------
// Prohibit the stack size from being changed.
// (bb 5/13/2005) it actually doesn't matter.