summaryrefslogtreecommitdiffstats
path: root/source/OSSupport/IsThread.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-21 20:44:16 +0200
committermadmaxoft <github@xoft.cz>2013-09-21 20:44:16 +0200
commitc56bc4b01c913febd2f062f17aff63e3415eb26c (patch)
tree0b61cee80d58a34e6395ee5650d51a730f3e7529 /source/OSSupport/IsThread.cpp
parentFixed cFile:IsFolder() and plugin-loading. (diff)
downloadcuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.tar
cuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.tar.gz
cuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.tar.bz2
cuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.tar.lz
cuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.tar.xz
cuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.tar.zst
cuberite-c56bc4b01c913febd2f062f17aff63e3415eb26c.zip
Diffstat (limited to 'source/OSSupport/IsThread.cpp')
-rw-r--r--source/OSSupport/IsThread.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/source/OSSupport/IsThread.cpp b/source/OSSupport/IsThread.cpp
index d5fbfcf19..e1ef84c17 100644
--- a/source/OSSupport/IsThread.cpp
+++ b/source/OSSupport/IsThread.cpp
@@ -53,11 +53,7 @@ static void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName)
cIsThread::cIsThread(const AString & iThreadName) :
m_ThreadName(iThreadName),
m_ShouldTerminate(false),
- #ifdef _WIN32
- m_Handle(NULL)
- #else // _WIN32
- m_HasStarted(false)
- #endif // else _WIN32
+ m_Handle(NULL)
{
}
@@ -77,9 +73,9 @@ cIsThread::~cIsThread()
bool cIsThread::Start(void)
{
+ ASSERT(m_Handle == NULL); // Has already started one thread?
+
#ifdef _WIN32
- ASSERT(m_Handle == NULL); // Has already started one thread?
-
// Create the thread suspended, so that the mHandle variable is valid in the thread procedure
DWORD ThreadID = 0;
m_Handle = CreateThread(NULL, 0, thrExecute, this, CREATE_SUSPENDED, &ThreadID);
@@ -99,14 +95,11 @@ bool cIsThread::Start(void)
#endif // _DEBUG and _MSC_VER
#else // _WIN32
- ASSERT(!m_HasStarted);
-
if (pthread_create(&m_Handle, NULL, thrExecute, this))
{
LOGERROR("ERROR: Could not create thread \"%s\", !", m_ThreadName.c_str());
return false;
}
- m_HasStarted = true;
#endif // else _WIN32
return true;
@@ -158,7 +151,6 @@ bool cIsThread::Wait(void)
LOGD("Thread %s finished", m_ThreadName.c_str());
#endif // LOGD
- m_HasStarted = false;
return (res == 0);
#endif // else _WIN32
}