LinuxCNC Documentation

SYNOPSIS

#include <hal.h>

int hal_exit(int comp_id);

ARGUMENTS

comp_id

A HAL component identifier returned by an earlier call to hal_init.

DESCRIPTION

The function hal_exit() shuts down and cleans up HAL and RTAPI. It must be called prior to exit by any module that called hal_init(3).

Each hal_init(3) call must be matched with a hal_exit() call. Failing to do so will leak resources in HAL memory and may hamper proper shutdown. Usually you’d call hal_exit() in rtapi_app_exit(3).

REALTIME CONSIDERATIONS

Call only from within non-realtime or init/cleanup code, not from realtime tasks.

RETURN VALUE

Returns zero (0) on success or a HAL status code:

-EFAULT

The shared memory was not mapped.

-ENOENT

The component does not exist.

SEE ALSO