This documentation is no longer maintained. For documentation of the current version of emc2, please see http://www.linuxcnc.org/docview/html

THREADS

NAME
SYNOPSIS
DESCRIPTION
FUNCTIONS
PINS
PARAMETERS
BUGS

NAME

threads − creates hard realtime HAL threads

SYNOPSIS

loadrt threads name1=name period1=period [fp1=<0|1>] [<thread-2-info>] [<thread-3-info>]

DESCRIPTION

threads is used to create hard realtime threads which can execute HAL functions at specific intervals. It is not a true HAL component, in that it does not export any functions, pins, or parameters of its own. Once it has created one or more threads, the threads stand alone, and the threads component can be unloaded without affecting them. In fact, it can be unloaded and then reloaded to create additional threads, as many times as needed.

threads can create up to three realtime threads. Threads must be created in order, from fastest to slowest. Each thread is specified by three arguments. name1 is used to specify the name of the first thread (thread 1). period1 is used to specify the period of thread 1 in nanoseconds. Both name and period are required. The third argument, fp1 is optional, and is used to specify if thread 1 will be used to execute floating point code. If not specified, it defaults to 1, which means that the thread will support floating point. Specify 0 to disable floating point support, which saves a small amount of execution time by not saving the FPU context. For additional threads, name2, period2, fp2, name3, period3, and fp3 work exactly the same. If more than three threads are needed, unload threads, then reload it to create more threads.

FUNCTIONS

None

PINS

None

PARAMETERS

None

BUGS

The existence of threads might be considered a bug. Ideally, creation and deletion of threads would be done directly with halcmd commands, such as "newthread name period", "delthread name", or similar. However, limitations in the current HAL implementation require thread creation to take place in kernel space, and loading a component is the most straightforward way to do that.