On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTKernel-32
RTKernel-32 Programming Manual
Introduction
Multitasking, Real-Time, and RTKernel-32
Module RTKernel-32
Alternate APIs for RTKernel-32
RTKernel-C 4.5 for DOS Compatible API
Win32 Thread Compatible API
Win32 Priorities
Win32 Handles
Win32 and RTKernel-32 Error Handling
Mixing RTKernel-32 and Win32 APIs
Function GetCurrentThreadId
Function CreateThread
Function ExitThread
Function TerminateThread
Function GetExitCodeThread
Function GetCurrentThread
Function Sleep
Function GetTickCount
Function GetTickCount64
Function SuspendThread
Function ResumeThread
Function SetThreadPriority
Function GetThreadPriority
Function InitializeCriticalSection
Function InitializeCriticalSectionAndSpinCount
Function EnterCriticalSection
Function TryEnterCriticalSection
Function LeaveCriticalSection
Function DeleteCriticalSection
Function CreateEvent
Function CreateMutex
Function CreateSemaphore
Function OpenEvent
Function OpenMutex
Function OpenSemaphore
Function SetEvent
Function ResetEvent
Function PulseEvent
Function ReleaseMutex
Function ReleaseSemaphore
Function WaitForSingleObject
Function WaitForMultipleObjects
Function QueryPerformanceCounter
Function QueryPerformanceFrequency
Function GetThreadId
Function SleepEx
Function QueueUserAPC
Function QueueUserWorkItem
Function GetSystemTimeAdjustment
Function SwitchToThread
Function CreateWaitableTimer
Function SetWaitableTimer
Function OpenWaitableTimer
Function CancelWaitableTimer
Function SetThreadAffinityMask
Function SetThreadGroupAffinity
Supplemental Modules
RTKernel-32 Drivers
Demo Programs
Advanced Topics
Typical Error Sources
Error and Information Messages
RTKernel-32 Reference Manual
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
Function CreateThread
CreateThread allocates a thread object and associates a Win32 handle with it. The thread is created by calling RTKCreateThread. The name of the task is set to "Win32 Thread". Floating point context maintenance for the new thread is controlled by RTKConfig.Flags. The priority is set to RTKConfig.MainPriority. If this is 0, RTKConfig.DefaultPriority is used. If this value is also 0, the new thread is created with the priority of the creating thread. *ThreadId receives the RTKernel-32 task handle. In addition, an event semaphore is associated with the thread object to allow waiting for task termination.
If parameter dwStackSize is 0, RTKConfig.DefaultTaskStackSize is used.
The thread object created by this function exists until the last handle to the thread is closed using CloseHandle and the thread terminates, in either order.
Usually, you should not call CreateThread directly. Instead, run-time system routines provided for thread creation (like _beginthread) or RTKRTLCreateThread should be used.
All high-level thread creation functions of the C/C++ run-time systems call CreateThread. Please note that some of these will automatically close the returned Win32 handle, while others do not. If you need a handle with a longer life span, use DuplicateHandle to get a second handle. Please also note that some run-time system functions do not return the Win32 handle, but the thread ID.
Win32 Thread Compatible API
Function GetCurrentThreadId
Function ExitThread
|