12 #include <ecl/config/ecl.hpp> 13 #if defined(ECL_IS_WIN32) 20 #include "../../include/ecl/threads/thread_win.hpp" 38 start(
function, priority, stack_size);
53 thread_task =
new threads::ThreadTask< NullaryFreeFunction<void> >(nullary_function_object, priority);
57 thread_handle = CreateThread(NULL,
59 (LPTHREAD_START_ROUTINE)threads::ThreadTask< NullaryFreeFunction<void> >::EntryPoint,
72 bResult = SetThreadPriority(thread_handle, THREAD_PRIORITY_TIME_CRITICAL);
77 bResult = SetThreadPriority(thread_handle, HIGH_PRIORITY_CLASS);
80 bResult = SetThreadPriority(thread_handle, THREAD_PRIORITY_ABOVE_NORMAL);
83 bResult = SetThreadPriority(thread_handle, THREAD_PRIORITY_BELOW_NORMAL);
86 bResult = SetThreadPriority(thread_handle, THREAD_PRIORITY_IDLE);
103 void Thread::cancel() ecl_debug_throw_decl(StandardException) {
105 unsigned long exitcode;
106 if (::GetExitCodeThread(thread_handle, &exitcode)) {
107 if (exitcode == 0x0103) {
109 ::TerminateThread(thread_handle, exitcode);
112 ::CloseHandle(thread_handle);
113 thread_handle = NULL;
120 join_requested =
false;
123 void Thread::join() ecl_debug_throw_decl(StandardException) {
124 join_requested =
true;
127 WaitForSingleObject(thread_handle, INFINITE);
Embedded control libraries.
#define ecl_assert_throw_decl(exception)
#define ecl_debug_throw_decl(exception)
#define ecl_debug_throw(exception)
NullaryFreeFunction< R > generateFunctionObject(R(*function)())
Priority
Shared abstraction of the scheduling priorities.