Using Threads

The CreateThread function creates either an RTSS or a Windows thread, depending on the current execution environment of the process. The initial or main thread of a process has a 32 KB stack. This size will not grow. It can only be altered by editing the Stack Reserve and Commit Size variables in the Visual Studio System Linker process properties.

You can specify the stack size of subsequently created threads of a process using CreateThread. The returned handle and thread ID are valid only in the CreateThread caller's environment. For instance, a Windows process cannot manipulate the priority of an RTSS thread because the handle for the thread is valid only in the RTSS environment. Also, the thread handle and ID are only valid in the process that created it.

You can use the RTX64 Interprocess Communication (IPC) mechanisms (such as mutex, semaphores, events, and shared memory) to synchronize and communicate between Windows and RTSS processes and threads.

Timer and Interrupt Objects

Timer and interrupt objects derive from threads; therefore, the handles for these objects are valid only in their own (Windows or RTSS) environment. Similarly, these objects can be manipulated only by processes in their own environment, and only by the threads in the process they were created in.

RTSS Environment

An RTSS or Proxy thread is the unit of execution in the RTSS environment. A ready-to-run thread is scheduled based upon its priority. A thread runs until it gives up the CPU.

NOTE: Proxy threads only run on the first RTSS processor.

A thread gives up the CPU when it:

Related topics: