From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/thread_win32_cpp-source.html | 137 ++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 docs/doxygen/nel/thread_win32_cpp-source.html (limited to 'docs/doxygen/nel/thread_win32_cpp-source.html') diff --git a/docs/doxygen/nel/thread_win32_cpp-source.html b/docs/doxygen/nel/thread_win32_cpp-source.html new file mode 100644 index 00000000..fbc89de2 --- /dev/null +++ b/docs/doxygen/nel/thread_win32_cpp-source.html @@ -0,0 +1,137 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

thread_win32.cpp

Go to the documentation of this file.
00001 
+00002 //#include "Core/precomp.h"
+00003 
+00004 #include "thread.h"
+00005 #include "thread_win32.h"
+00006 
+00007 /*************************************
+00008  Generic static create-thread function
+00009 *************************************/
+00010 
+00011 CL_Thread *CL_Thread::create(CL_Runnable *runnable)
+00012 {
+00013         return new CL_Thread_Win32(runnable);
+00014 }
+00015 
+00016 /*************************************
+00017         class CL_Thread_Win32
+00018 *************************************/
+00019 
+00020 
+00021 CL_Thread_Win32::CL_Thread_Win32(CL_Runnable *runnable)
+00022 {
+00023         this->runnable = runnable;
+00024         thread_handle = NULL;
+00025 }
+00026 
+00027 CL_Thread_Win32::~CL_Thread_Win32()
+00028 {
+00029         if (thread_handle != NULL) terminate();
+00030 }
+00031 
+00032 unsigned long CL_Thread_Win32::func_proxy(void *arg)
+00033 {
+00034         CL_Thread_Win32 *parent = (CL_Thread_Win32 *) arg;
+00035         parent->runnable->run();
+00036 
+00037         return 0;
+00038 }
+00039 
+00040 void CL_Thread_Win32::start()
+00041 {
+00042         thread_handle = CreateThread(NULL, 0, func_proxy, this, 0, &thread_id);
+00043         if (thread_handle == NULL)
+00044         {
+00045                 //throw CL_Error("Failed to create thread");
+00046         }
+00047 }
+00048 
+00049 void CL_Thread_Win32::terminate()
+00050 {
+00051         TerminateThread(thread_handle, 0);
+00052         CloseHandle(thread_handle);
+00053         thread_handle = NULL;
+00054 }
+00055 
+00056 void CL_Thread_Win32::wait()
+00057 {
+00058         if (thread_handle == NULL) return;
+00059 
+00060         WaitForSingleObject(thread_handle, INFINITE);
+00061         CloseHandle(thread_handle);
+00062         thread_handle = NULL;
+00063 }
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1