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
Supplemental Modules
RTKernel-32 Drivers
Demo Programs
Advanced Topics
RTKernel-32's Debug Version
How to Create Threads
Interrupt Handling
Avoid Polling
Preemptive or Cooperative Multitasking?
Waiting for Several Events
Avoid Large Message Types
Mutual Exclusion
Avoid Time Slicing
Cyclic Tasks (Timer)
Priorities
Starting Objects' Methods as Tasks
Performance and Interrupt Response Times
Multiprocessor Applications
OpenMP
Task Switches in Cooperative Scheduling
Writing Custom Kernel Drivers
Using the FPU in Interrupt Handlers
Typical Error Sources
Error and Information Messages
RTKernel-32 Reference Manual
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
How to Create Threads
RTKernel-32 programs can choose among several different methods to create threads:
Level |
Function |
Comment |
1 |
RTKCreateThread |
RTKernel-32's native, low-level thread creation function. |
2 |
CreateThread |
Win32 thread creation function; calls RTKCreateThread internally. |
3 |
_beginthreadNT, _beginthreadex, etc. |
C/C++ or Pascal run-time system library functions. These functions call Win32 function CreateThread internally. |
4 |
RTKRTLCreateThread |
RTKernel-32's thread creation function with run-time system support. This function calls a run-time system thread creation function internally. |
At each level, the preceding level is called.
Most applications should use level 4 or 3. Level 4 has the advantage that all RTKernel-32 parameters such as the thread's priority and flags are available. On the other hand, if portability between RTKernel-32 and Win32 is desired, level 3 might be better suited. Both level 3 and 4 use the multithread run-time system libraries, enabling such threads to call non-reentrant run-time system functions.
Threads created with level 1 and 2 cannot use C++ exceptions, and they must take their own precautions when non-reentrant run-time system functions are called. Level 1 is well suited for simple tasks not requiring any non-reentrant run-time system services or exceptions. CreateThread does not support all RTKernel-32 thread creation parameters, but is Win32 compatible.
Advanced Topics
RTKernel-32's Debug Version
Interrupt Handling
|