summaryrefslogtreecommitdiffstats
path: root/source/OSSupport
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-13 16:44:29 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-13 16:44:29 +0200
commit0ac24a98e4055f791f7dccee89997a7852c865b7 (patch)
treef1c361afa8142dcc1a169404b4f8deccb7dcf6b9 /source/OSSupport
parentRemoved comments (diff)
parentMerge pull request #84 from tonibm19/patch-2 (diff)
downloadcuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.gz
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.bz2
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.lz
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.xz
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.zst
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.zip
Diffstat (limited to 'source/OSSupport')
-rw-r--r--source/OSSupport/IsThread.cpp4
-rw-r--r--source/OSSupport/IsThread.h16
2 files changed, 13 insertions, 7 deletions
diff --git a/source/OSSupport/IsThread.cpp b/source/OSSupport/IsThread.cpp
index 9dcbc43eb..257c5c876 100644
--- a/source/OSSupport/IsThread.cpp
+++ b/source/OSSupport/IsThread.cpp
@@ -54,9 +54,9 @@ cIsThread::cIsThread(const AString & iThreadName) :
m_ThreadName(iThreadName),
m_ShouldTerminate(false),
#ifdef _WIN32
- m_Handle(NULL)
+ m_Handle(NULL)
#else // _WIN32
- m_HasStarted(false)
+ m_HasStarted(false)
#endif // else _WIN32
{
}
diff --git a/source/OSSupport/IsThread.h b/source/OSSupport/IsThread.h
index ed9a32852..2a4451a4a 100644
--- a/source/OSSupport/IsThread.h
+++ b/source/OSSupport/IsThread.h
@@ -26,18 +26,24 @@ In the descending class' constructor call the Start() method to start the thread
class cIsThread
{
protected:
- virtual void Execute(void) = 0; // This function is called in the new thread's context
+ /// This is the main thread entrypoint
+ virtual void Execute(void) = 0;
- volatile bool m_ShouldTerminate; // The overriden Execute() method should check this periodically and terminate if this is true
+ /// The overriden Execute() method should check this value periodically and terminate if this is true
+ volatile bool m_ShouldTerminate;
public:
cIsThread(const AString & iThreadName);
~cIsThread();
- bool Start(void); // Starts the thread
- bool Wait(void); // Waits for the thread to finish
+ /// Starts the thread; returns without waiting for the actual start
+ bool Start(void);
- static unsigned long GetCurrentID(void); // Returns the OS-dependent thread ID for the caller's thread
+ /// Waits for the thread to finish. Doesn't signalize the ShouldTerminate flag
+ bool Wait(void);
+
+ /// Returns the OS-dependent thread ID for the caller's thread
+ static unsigned long GetCurrentID(void);
private:
AString m_ThreadName;