- added safety check to thread execution

This commit is contained in:
Mark Vejvoda 2010-08-27 03:00:57 +00:00
parent 773bc8659f
commit a4e75417e4
1 changed files with 7 additions and 0 deletions

View File

@ -11,9 +11,12 @@
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <assert.h>
#include "noimpl.h"
using namespace std;
namespace Shared{ namespace Platform{
// =====================================
@ -39,6 +42,10 @@ void Thread::setPriority(Thread::Priority threadPriority) {
int Thread::beginExecution(void* data) {
Thread* thread = static_cast<Thread*> (data);
assert(thread != NULL);
if(thread == NULL) {
throw runtime_error("thread == NULL");
}
thread->execute();
return 0;
}