aboutsummaryrefslogtreecommitdiff
path: root/dep/efsw/src/efsw/Thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dep/efsw/src/efsw/Thread.cpp')
-rw-r--r--dep/efsw/src/efsw/Thread.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/dep/efsw/src/efsw/Thread.cpp b/dep/efsw/src/efsw/Thread.cpp
new file mode 100644
index 00000000000..fff41517dc1
--- /dev/null
+++ b/dep/efsw/src/efsw/Thread.cpp
@@ -0,0 +1,51 @@
+#include <efsw/Thread.hpp>
+#include <efsw/platform/platformimpl.hpp>
+
+namespace efsw {
+
+Thread::Thread() :
+ mThreadImpl(NULL),
+ mEntryPoint(NULL)
+{
+}
+
+Thread::~Thread()
+{
+ wait();
+
+ efSAFE_DELETE( mEntryPoint );
+}
+
+void Thread::launch()
+{
+ wait();
+
+ mThreadImpl = new Platform::ThreadImpl( this );
+}
+
+void Thread::wait()
+{
+ if ( mThreadImpl )
+ {
+ mThreadImpl->wait();
+
+ efSAFE_DELETE( mThreadImpl );
+ }
+}
+
+void Thread::terminate()
+{
+ if ( mThreadImpl )
+ {
+ mThreadImpl->terminate();
+
+ efSAFE_DELETE( mThreadImpl );
+ }
+}
+
+void Thread::run()
+{
+ mEntryPoint->run();
+}
+
+}