From 80bf70efbb2159658e02436239e94283a33cfe35 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 11 Apr 2012 22:05:18 +0200 Subject: [PATCH] Changed: Make CWinThread::start more sane, and fixed a typo --HG-- branch : sound_dev --- code/nel/src/misc/p_thread.cpp | 2 +- code/nel/src/misc/win_thread.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/nel/src/misc/p_thread.cpp b/code/nel/src/misc/p_thread.cpp index 9524ca0bb..f752f4bdf 100644 --- a/code/nel/src/misc/p_thread.cpp +++ b/code/nel/src/misc/p_thread.cpp @@ -196,7 +196,7 @@ void CPThread::wait () { if (_State == ThreadStateRunning) { - int error = pthread_join(_ThreadHandle, 0) != 0; + int error = pthread_join(_ThreadHandle, 0); switch (error) { case 0: diff --git a/code/nel/src/misc/win_thread.cpp b/code/nel/src/misc/win_thread.cpp index f8a961a74..c9bfc90a1 100644 --- a/code/nel/src/misc/win_thread.cpp +++ b/code/nel/src/misc/win_thread.cpp @@ -190,6 +190,9 @@ CWinThread::~CWinThread () void CWinThread::start () { + if (isRunning()) + throw EThread("Starting a thread that is already started, existing thread will continue running, this should not happen"); + // ThreadHandle = (void *) ::CreateThread (NULL, _StackSize, ProxyFunc, this, 0, (DWORD *)&ThreadId); ThreadHandle = (void *) ::CreateThread (NULL, 0, ProxyFunc, this, 0, (DWORD *)&ThreadId); // nldebug("NLMISC: thread %x started for runnable '%x'", typeid( Runnable ).name());