Skip to content

Commit

Permalink
COMMON: Add a parameter to Thread::createThread() to name the thread
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Mar 4, 2017
1 parent ce50cf1 commit 6db0b77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ Thread::~Thread() {
destroyThread();
}

bool Thread::createThread() {
bool Thread::createThread(const UString &name) {
if (_threadRunning)
// Already running, nothing to do
return true;

// Try to create the thread
if (!(_thread = SDL_CreateThread(threadHelper, 0, static_cast<void *>(this))))
if (!(_thread = SDL_CreateThread(threadHelper, name.empty() ? 0 : name.c_str(), static_cast<void *>(this))))
return false;

return true;
Expand Down
4 changes: 3 additions & 1 deletion src/common/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include <boost/noncopyable.hpp>

#include "src/common/ustring.h"

namespace Common {

/** A class that creates its own thread. */
Expand All @@ -39,7 +41,7 @@ class Thread : boost::noncopyable {
Thread();
virtual ~Thread();

bool createThread();
bool createThread(const UString &name = "");
bool destroyThread();

protected:
Expand Down

0 comments on commit 6db0b77

Please sign in to comment.