mirror of
https://github.com/eclipse-threadx/threadx.git
synced 2025-11-16 12:34:48 +00:00
90 lines
5.2 KiB
C
90 lines
5.2 KiB
C
/***************************************************************************
|
|
* Copyright (c) 2024 Microsoft Corporation
|
|
*
|
|
* This program and the accompanying materials are made available under the
|
|
* terms of the MIT License which is available at
|
|
* https://opensource.org/licenses/MIT.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
**************************************************************************/
|
|
|
|
|
|
/**************************************************************************/
|
|
/**************************************************************************/
|
|
/** */
|
|
/** POSIX wrapper for THREADX */
|
|
/** */
|
|
/** */
|
|
/** */
|
|
/**************************************************************************/
|
|
/**************************************************************************/
|
|
|
|
/* Include necessary system files. */
|
|
|
|
#include "tx_api.h" /* Threadx API */
|
|
#include "pthread.h" /* Posix API */
|
|
#include "px_int.h" /* Posix helper functions */
|
|
|
|
/**************************************************************************/
|
|
/* */
|
|
/* FUNCTION RELEASE */
|
|
/* */
|
|
/* pthread_attr_setinheritsched PORTABLE C */
|
|
/* 6.1.7 */
|
|
/* AUTHOR */
|
|
/* */
|
|
/* William E. Lamie, Microsoft Corporation */
|
|
/* */
|
|
/* DESCRIPTION */
|
|
/* */
|
|
/* This function sets the inheritsched attribute from the thread */
|
|
/* attributes object specified.The inheritsched attribute will be one */
|
|
/* of PTHREAD_EXPLICIT_SCHED or PTHREAD_INHERIT_SCHED. */
|
|
/* The default inheritsched attribute is PTHREAD_EXPLICIT_SCHED, */
|
|
/* with a default priority of 0. */
|
|
/* Use the inheritsched parameter to inherit or explicitly specify the */
|
|
/* scheduling attributes when creating new threads. */
|
|
/* */
|
|
/* */
|
|
/* INPUT */
|
|
/* */
|
|
/* attr Address of the thread attributes */
|
|
/* inheritsched inheritsched attribute to set */
|
|
/* */
|
|
/* */
|
|
/* OUTPUT */
|
|
/* */
|
|
/* 0 if successful */
|
|
/* Value in case of any error */
|
|
/* */
|
|
/* CALLS */
|
|
/* */
|
|
/* None */
|
|
/* */
|
|
/* CALLED BY */
|
|
/* */
|
|
/* Application Code */
|
|
/* */
|
|
/* RELEASE HISTORY */
|
|
/* */
|
|
/* DATE NAME DESCRIPTION */
|
|
/* */
|
|
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
|
|
/* */
|
|
/**************************************************************************/
|
|
INT pthread_attr_setinheritsched(pthread_attr_t *attr, INT inheritsched)
|
|
{
|
|
/* First check the attribute object is already destroyed? */
|
|
if (attr->inuse == TX_FALSE)
|
|
{
|
|
posix_errno = EINVAL;
|
|
posix_set_pthread_errno(EINVAL);
|
|
return(EINVAL);
|
|
}
|
|
else
|
|
{
|
|
attr->inherit_sched = inheritsched ;
|
|
return(OK);
|
|
}
|
|
}
|