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
|
Win32 Handles
Handles are an important concept of the Win32 API. RTKernel-32 uses RTTarget-32's handle manager to implement handles for threads, semaphores, events, and mutex objects. The number of available Win32 handles is limited but can be changed (please refer to the RTTarget-32 Programming Manual, section Win32 Handles). It is very important that all handles of objects with limited lifetime are closed to avoid errors caused by an out-of-handle situation. RTKernel-32 does not define functions CloseHandle and DuplicateHandle; however, RTTarget-32's corresponding functions can be used, even for handles created with RTKernel-32's Win32 emulation.
Win32 handles (type HANDLE) must not be confused with RTKernel-32's task handles (type RTKTaskHandle). Win32 handles indirectly reference objects, while RTKernel-32 handles reference them directly. Consequently, Win32 handles can be duplicated with function DuplicateHandle; the associated object is destroyed only after all handles have been closed. In contrast, RTKernel-32 task handles (like mailboxes or semaphores) cannot be duplicated; they can only be copied, which does not create a new handle. Any call to RTKTerminateTask (or RTKDeleteSemaphore / RTKDeleteMailbox) will immediately destroy the associated object. In particular, this is also true for multiple references to the same semaphore obtained from RTKOpenSemaphore.
Win32 also knows Thread IDs. These are unique (there is exactly one Thread ID for each thread) and cannot be duplicated. Under RTKernel-32, Win32 Thread IDs are identical to RTKernel-32 task handles.
Win32 Thread Compatible API
Win32 Priorities
Win32 and RTKernel-32 Error Handling
|