Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#3881 closed enhancement (fixed)

Add API functions to map a task priority to/from a POSIX thread priority

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: rtems Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Mapping task priorities to/from POSIX thread priorities is probably done in many applications. There seems to be no API to help doing this. Add the following API functions to map a task priority to/from a POSIX thread priority:

/**
 * @brief Map a task priority to the corresonding POSIX thread priority.
 *
 * @param scheduler_id Identifier of the scheduler instance.
 * @param priority The task priority to map.
 * @param[out] posix_priority Pointer to a POSIX thread priority value.
 *
 * @retval RTEMS_SUCCESSFUL Successful operation.
 * @retval RTEMS_INVALID_ADDRESS The @a posix_priority parameter is @c NULL.
 * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier.
 * @retval RTEMS_INVALID_PRIORITY Invalid task priority.
 */
rtems_status_code rtems_scheduler_map_to_posix_priority(
  rtems_id             scheduler_id,
  rtems_task_priority  priority,
  int                 *posix_priority
);

/**
 * @brief Map a POSIX thread priority to the corresonding task priority.
 *
 * @param scheduler_id Identifier of the scheduler instance.
 * @param posix_priority The POSIX thread priority to map.
 * @param[out] priority Pointer to a task priority value.
 *
 * @retval RTEMS_SUCCESSFUL Successful operation.
 * @retval RTEMS_INVALID_ADDRESS The @a priority parameter is @c NULL.
 * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier.
 * @retval RTEMS_INVALID_PRIORITY Invalid POSIX thread priority.
 */
rtems_status_code rtems_scheduler_map_from_posix_priority(
  rtems_id             scheduler_id,
  int                  posix_priority,
  rtems_task_priority *priority
);

Change History (4)

comment:1 Changed on 03/03/20 at 06:14:42 by Sebastian Huber <sebastian.huber@…>

In [changeset:"38736c69f84a07838dc18f7357ce5f14e555c860/rtems" 38736c6/rtems]:

rtems: Add rtems_scheduler_map_priority_to_posix()

Update #3881.

comment:2 Changed on 03/03/20 at 06:14:46 by Sebastian Huber <sebastian.huber@…>

In [changeset:"180201094e4237679bd27df1e36b4f72d6840870/rtems" 18020109/rtems]:

rtems: Add rtems_scheduler_map_priority_from_posix()

Update #3881.

comment:3 Changed on 03/03/20 at 06:16:12 by Sebastian Huber <sebastian.huber@…>

In [changeset:"e458fedc3800bd64712ed2bf7461f196104ca744/rtems-docs" e458fed/rtems-docs]:

c-user: rtems_scheduler_map_priority_to_posix()

Update #3881.

comment:4 Changed on 03/03/20 at 06:16:14 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In [changeset:"ac61465d2c0a8b7d68ff5577f25c9f173b6c8d49/rtems-docs" ac61465/rtems-docs]:

c-user: rtems_scheduler_map_priority_from_posix()

Close #3881.

Note: See TracTickets for help on using tickets.