---
name: "rtapi_task_pause"
section: "3rtapi"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rtapi_task_pause"
---

# rtapi\_task\_pause(3rtapi)

pause and resume real-time tasks

## NAME

rtapi\_task\_pause, rtapi\_task\_resume - pause and resume real-time tasks

## SYNTAX

void rtapi\_task\_pause(int *task\_id*)

void rtapi\_task\_resume(int *task\_id*)

## ARGUMENTS

- *task\_id*

  An RTAPI task identifier returned by an earlier call to **rtapi\_task\_new**.

## DESCRIPTION

**rtapi\_task\_resume** starts a task in free-running mode.  The task must be in the "paused" state.

A free running task runs continuously until either:

- 1\)

  It is prempted by a higher priority task.  It will resume as soon as the higher priority task releases the CPU.

- 2\)

  It calls a blocking function, like **rtapi\_sem\_take**.  It will resume when the function unblocks.

- 3\)

  It is returned to the "paused" state by **rtapi\_task\_pause**.  May be called from init/cleanup code, and from within realtime tasks.

  **rtapi\_task\_pause** causes a task to stop execution and change to the "paused" state.  The task can be free-running or periodic. Note that **rtapi\_task\_pause** may called from any task, or from init or cleanup code, not just from the task that is to be paused. The task will resume execution when either **rtapi\_task\_resume** or **rtapi\_task\_start** (depending on whether this is a free-running or periodic task) is called.

## REALTIME CONSIDERATIONS

May be called from init/cleanup code, and from within realtime tasks.

## RETURN VALUE

An RTAPI status code.

## SEE ALSO

**[rtapi\_task\_new(3rtapi)](/rtapi_task_new/3rtapi.md)**, **[rtapi\_task\_start(3rtapi)](/rtapi_task_start/3rtapi.md)**
