mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
include/, sched/, and libc/: Add support for sporadic scheduling parameters in struct sched_param, posix_spawnattr_t, and pthread_attr_t. Update all user interfaces to pass sporadic scheduling parameters. Feature is dependent on EXPERIMENTAL and no changes have yet been made to core scheduling logic.
This commit is contained in:
@@ -45,26 +45,6 @@
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -98,13 +78,18 @@ int pthread_attr_getschedparam(FAR const pthread_attr_t *attr,
|
||||
}
|
||||
else
|
||||
{
|
||||
param->sched_priority = attr->priority;
|
||||
param->sched_priority = (int)attr->priority;
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
param->sched_ss_low_priority = (int)attr->low_priority;
|
||||
param->sched_ss_max_repl = (int)attr->max_repl;
|
||||
param->sched_ss_repl_period.tv_sec = attr->repl_period.tv_sec;
|
||||
param->sched_ss_repl_period.tv_nsec = attr->repl_period.tv_nsec;
|
||||
param->sched_ss_init_budget.tv_sec = attr->budget.tv_sec;
|
||||
param->sched_ss_init_budget.tv_nsec = attr->budget.tv_nsec;
|
||||
#endif
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
sdbg("Returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* libc/pthread/pthread_attrsetschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -45,30 +45,6 @@
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_attr_setschedparam
|
||||
*
|
||||
@@ -86,7 +62,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_attr_setschedparam(FAR pthread_attr_t *attr,
|
||||
FAR const struct sched_param *param)
|
||||
FAR const struct sched_param *param)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -98,11 +74,18 @@ int pthread_attr_setschedparam(FAR pthread_attr_t *attr,
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->priority = (short)param->sched_priority;
|
||||
attr->priority = (short)param->sched_priority;
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
attr->low_priority = (uint8_t)param->sched_ss_low_priority;
|
||||
attr->max_repl = (uint8_t)param->sched_ss_max_repl;
|
||||
attr->repl_period.tv_sec = param->sched_ss_repl_period.tv_sec;
|
||||
attr->repl_period.tv_nsec = param->sched_ss_repl_period.tv_nsec;
|
||||
attr->budget.tv_sec = param->sched_ss_init_budget.tv_sec;
|
||||
attr->budget.tv_nsec = param->sched_ss_init_budget.tv_nsec;
|
||||
#endif
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
sdbg("Returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user