LinuxCNC Documentation
This page is 0% translated. Untranslated text is shown in English.

SYNOPSIS

#include <hal.h>

int hal_create_thread(const char *name, unsigned long period, int uses_fp);
int hal_thread_delete(const char *name);

ARGUMENTS

name

The name of the thread.

period

The interval, in nanoseconds, between iterations of the thread.

uses_fp

Deprecated and ignored. All threads now unconditionally save and restore floating point state. This parameter will be removed in a future version.

DESCRIPTION

hal_create_thread establishes a realtime thread that will execute one or more HAL functions periodically.

All thread periods are rounded to integer multiples of the hardware timer period, and the timer period is based on the first thread created. Threads must be created in order, from the fastest to the slowest. HAL assigns decreasing priorities to threads that are created later, so creating them from fastest to slowest results in rate monotonic priority scheduling.

hal_delete_thread deletes a previously created thread.

REALTIME CONSIDERATIONS

Call only from realtime init code, not from other realtime or non-realtime code.

RETURN VALUE

Returns a HAL status code.

-EFAULT

The shared memory was not mapped.

-EINVAL

An invalid argument was passed.

-EPERM

HAL is config locked.

-EEXIST

The thread name already exists (hal_create_thread).

-ENOMEM

Failed to allocate memory for thread registration.

-ENOENT

The thread does not exist (hal_thread_delete).

SEE ALSO