Home |
RTKernel-32 Programming Manual Multitasking, Real-Time, and RTKernel-32 Alternate APIs for RTKernel-32 RTKernel-C 4.5 for DOS Compatible API Win32 Handles Win32 and RTKernel-32 Error Handling Mixing RTKernel-32 and Win32 APIs Function InitializeCriticalSection Function InitializeCriticalSectionAndSpinCount Function TryEnterCriticalSection Function DeleteCriticalSection Function WaitForMultipleObjects Function QueryPerformanceCounter Function QueryPerformanceFrequency Function GetSystemTimeAdjustment Function SetThreadAffinityMask Function SetThreadGroupAffinity |
Win32 HandlesHandles 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 and RTKernel-32 Error Handling
|