mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 05:42:05 +08:00
sched/: Replace explict references to g_readytorun with indirect references via the this_task() macro
This commit is contained in:
@@ -11462,4 +11462,8 @@
|
||||
* fs/procfs/fs_procfskmm.c: Add /proc/kmm entry that shows that state of
|
||||
the kernel heap. Only useful in PROTECTED and KERNEL build modes where
|
||||
there is a kernel heap (2016-02-06).
|
||||
* sched/ and arch/: Replace explicit access to the OS internal data structure
|
||||
g_readytorun() with the wrapper this_task() which hides the implementation
|
||||
and will permit such things as more scalable representations of task queues
|
||||
and SMP (2016-02-06).
|
||||
|
||||
|
||||
@@ -228,13 +228,9 @@ o Task/Scheduler (sched/)
|
||||
hidden behind simple accessor functions and so the internal
|
||||
data structures can be changed if need with very little impact.
|
||||
|
||||
The only area are the list structure is not well contained is
|
||||
in the sequence of code that finds the current running task:
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAT struc tcb_s *)g_readytorun.head;
|
||||
|
||||
That needs to be hidden behind a macro (it would also be a problem
|
||||
for any SMP implementation).
|
||||
Explicity refereence to the list strucutre are hidden behnid
|
||||
the macro this_task().
|
||||
|
||||
Status: Open
|
||||
Priority: Low. Things are just the way that we want them for the way
|
||||
|
||||
+1
-1
Submodule arch updated: e15b5dec6a...5c9c3dc73e
@@ -74,7 +74,7 @@
|
||||
|
||||
int clearenv(void)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
DEBUGASSERT(tcb->group);
|
||||
|
||||
env_release(tcb->group);
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
int env_dup(FAR struct task_group_s *group)
|
||||
{
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = this_task();
|
||||
FAR char *envp = NULL;
|
||||
size_t envlen;
|
||||
int ret = OK;
|
||||
|
||||
@@ -94,7 +94,7 @@ FAR char *getenv(const char *name)
|
||||
/* Get a reference to the thread-private environ in the TCB. */
|
||||
|
||||
sched_lock();
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
group = rtcb->group;
|
||||
|
||||
/* Check if the variable exists */
|
||||
|
||||
@@ -85,7 +85,7 @@ FAR char **get_environ_ptr(void)
|
||||
|
||||
/* Return a reference to the thread-private environ in the TCB. */
|
||||
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = this_task();
|
||||
if (ptcb->envp)
|
||||
{
|
||||
return &ptcb->envp->ev_env;
|
||||
|
||||
@@ -124,7 +124,7 @@ int setenv(FAR const char *name, FAR const char *value, int overwrite)
|
||||
/* Get a reference to the thread-private environ in the TCB. */
|
||||
|
||||
sched_lock();
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
group = rtcb->group;
|
||||
DEBUGASSERT(group);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
int unsetenv(FAR const char *name)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR char *pvar;
|
||||
FAR char *newenvp;
|
||||
|
||||
@@ -97,11 +97,11 @@ FAR int *get_errno_ptr(void)
|
||||
* logic (see, for example, task_exit.c).
|
||||
*
|
||||
* There is also a corner case early in the initialization sequence:
|
||||
* The ready to run list may not yet be initialized and g_readytorun.head
|
||||
* The ready to run list may not yet be initialized and this_task()
|
||||
* may be NULL.
|
||||
*/
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
if (rtcb && rtcb->task_state == TSTATE_TASK_RUNNING)
|
||||
{
|
||||
/* Yes.. the task is running normally. Return a reference to the
|
||||
|
||||
@@ -114,7 +114,7 @@ int group_addrenv(FAR struct tcb_s *tcb)
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
tcb = this_task();
|
||||
}
|
||||
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
|
||||
@@ -69,7 +69,7 @@ void group_free(FAR struct task_group_s *group, FAR void *mem)
|
||||
|
||||
if (!group)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
group = tcb->group;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ static inline int group_addmember(FAR struct task_group_s *group, pid_t pid)
|
||||
|
||||
int group_bind(FAR struct pthread_tcb_s *tcb)
|
||||
{
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = this_task();
|
||||
|
||||
DEBUGASSERT(ptcb && tcb && ptcb->group && !tcb->cmn.group);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ FAR void *group_malloc(FAR struct task_group_s *group, size_t nbytes)
|
||||
|
||||
if (!group)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
group = tcb->group;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ static inline void sched_dupfiles(FAR struct task_tcb_s *tcb)
|
||||
{
|
||||
/* The parent task is the one at the head of the ready-to-run list */
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct file *parent;
|
||||
FAR struct file *child;
|
||||
int i;
|
||||
@@ -147,7 +147,7 @@ static inline void sched_dupsockets(FAR struct task_tcb_s *tcb)
|
||||
{
|
||||
/* The parent task is the one at the head of the ready-to-run list */
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct socket *parent;
|
||||
FAR struct socket *child;
|
||||
int i;
|
||||
|
||||
@@ -127,10 +127,10 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mq_notify(mqd_t mqdes, const struct sigevent *notification)
|
||||
int mq_notify(mqd_t mqdes, FAR const struct sigevent *notification)
|
||||
{
|
||||
struct tcb_s *rtcb;
|
||||
struct mqueue_inode_s *msgq;
|
||||
FAR struct tcb_s *rtcb;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
int errval;
|
||||
|
||||
/* Was a valid message queue descriptor provided? */
|
||||
@@ -150,7 +150,7 @@ int mq_notify(mqd_t mqdes, const struct sigevent *notification)
|
||||
|
||||
/* Get the current process ID */
|
||||
|
||||
rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* Is there already a notification attached */
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
||||
{
|
||||
/* Yes.. Block and try again */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
rtcb->msgwaitq = msgq;
|
||||
msgq->nwaitnotempty++;
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ int mq_waitsend(mqd_t mqdes)
|
||||
* When we are unblocked, we will try again
|
||||
*/
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
rtcb->msgwaitq = msgq;
|
||||
msgq->nwaitnotfull++;
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ static void mq_rcvtimeout(int argc, wdparm_t pid)
|
||||
ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
||||
FAR int *prio, FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct mqueue_msg_s *mqmsg;
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
||||
@@ -183,7 +183,7 @@ static void mq_sndtimeout(int argc, wdparm_t pid)
|
||||
int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
||||
FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
FAR struct mqueue_msg_s *mqmsg = NULL;
|
||||
irqstate_t saved_state;
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
void pg_miss(void)
|
||||
{
|
||||
FAR struct tcb_s *ftcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ftcb = this_task();
|
||||
FAR struct tcb_s *wtcb;
|
||||
|
||||
/* Sanity checking
|
||||
|
||||
@@ -279,7 +279,7 @@ static inline bool pg_dequeue(void)
|
||||
* if a new higher priority fill is required).
|
||||
*/
|
||||
|
||||
FAR struct tcb_s *wtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *wtcb = this_task();
|
||||
if (wtcb->sched_priority > CONFIG_PAGING_DEFPRIO &&
|
||||
wtcb->sched_priority > g_pftcb->sched_priority)
|
||||
{
|
||||
@@ -456,7 +456,7 @@ static inline bool pg_startfill(void)
|
||||
|
||||
static inline void pg_alldone(void)
|
||||
{
|
||||
FAR struct tcb_s *wtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *wtcb = this_task();
|
||||
g_pftcb = NULL;
|
||||
pgllvdbg("New worker priority. %d->%d\n",
|
||||
wtcb->sched_priority, CONFIG_PAGING_DEFPRIO);
|
||||
|
||||
@@ -47,37 +47,13 @@
|
||||
#include "sched/sched.h"
|
||||
#include "pthread/pthread.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_cancel(pthread_t thread)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
FAR struct tcb_s *tcb;
|
||||
|
||||
/* First, make sure that the handle references a valid thread */
|
||||
|
||||
@@ -132,7 +108,7 @@ int pthread_cancel(pthread_t thread)
|
||||
* same as pthread_exit(PTHREAD_CANCELED).
|
||||
*/
|
||||
|
||||
if (tcb == (struct tcb_s *)g_readytorun.head)
|
||||
if (tcb == this_task())
|
||||
{
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo)
|
||||
int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
|
||||
FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
int ticks;
|
||||
int mypid = (int)getpid();
|
||||
irqstate_t int_state;
|
||||
|
||||
@@ -165,7 +165,7 @@ static inline void pthread_addjoininfo(FAR struct task_group_s *group,
|
||||
|
||||
static void pthread_start(void)
|
||||
{
|
||||
FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)this_task();
|
||||
FAR struct task_group_s *group = ptcb->cmn.group;
|
||||
FAR struct join_s *pjoin = (FAR struct join_s *)ptcb->joininfo;
|
||||
pthread_addr_t exit_status;
|
||||
@@ -269,8 +269,7 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr,
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Share the address environment of the parent task group. */
|
||||
|
||||
ret = up_addrenv_attach(ptcb->cmn.group,
|
||||
(FAR struct tcb_s *)g_readytorun.head);
|
||||
ret = up_addrenv_attach(ptcb->cmn.group, this_task());
|
||||
if (ret < 0)
|
||||
{
|
||||
errcode = -ret;
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
int pthread_detach(pthread_t thread)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct join_s *pjoin;
|
||||
int ret;
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
void pthread_exit(FAR void *exit_value)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
int status;
|
||||
|
||||
sdbg("exit_value=%p\n", exit_value);
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
FAR void *pthread_getspecific(pthread_key_t key)
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)this_task();
|
||||
FAR struct task_group_s *group = rtcb->cmn.group;
|
||||
FAR void *ret = NULL;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct join_s *pjoin;
|
||||
int ret;
|
||||
|
||||
@@ -112,7 +112,7 @@ int pthread_key_create(FAR pthread_key_t *key,
|
||||
CODE void (*destructor)(FAR void *))
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
int ret = EAGAIN;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ int pthread_kill(pthread_t thread, int signo)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#endif
|
||||
FAR struct tcb_s *stcb;
|
||||
siginfo_t info;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
int pthread_setcancelstate(int state, FAR int *oldstate)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
int ret = OK;
|
||||
|
||||
/* Suppress context changes for a bit so that the flags are stable. (the
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
int pthread_setspecific(pthread_key_t key, FAR const void *value)
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)this_task();
|
||||
FAR struct task_group_s *group = rtcb->cmn.group;
|
||||
int ret = EINVAL;
|
||||
|
||||
|
||||
@@ -64,6 +64,14 @@
|
||||
#define MAX_TASKS_MASK (CONFIG_MAX_TASKS-1)
|
||||
#define PIDHASH(pid) ((pid) & MAX_TASKS_MASK)
|
||||
|
||||
/* These are macros to access the current CPU and the current task on a CPU.
|
||||
* These macros are intended to support a future SMP implementation.
|
||||
*/
|
||||
|
||||
#define current_task(cpu) ((FAR struct tcb_s *)g_readytorun.head)
|
||||
#define this_cpu() (0)
|
||||
#define this_task() (current_task(this_cpu))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
bool ret;
|
||||
|
||||
/* Check if pre-emption is disabled for the current running task and if
|
||||
|
||||
@@ -111,7 +111,7 @@ volatile uint32_t g_cpuload_total;
|
||||
|
||||
void weak_function sched_process_cpuload(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
int hash_index;
|
||||
int i;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
FAR struct filelist *sched_getfiles(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
/* The group may be NULL under certain conditions. For example, if
|
||||
|
||||
@@ -110,7 +110,7 @@ int sched_getparam (pid_t pid, FAR struct sched_param *param)
|
||||
|
||||
/* Check if the task to restart is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if ((pid == 0) || (pid == rtcb->pid))
|
||||
{
|
||||
/* Return the priority if the calling task. */
|
||||
|
||||
@@ -107,7 +107,7 @@ int sched_getscheduler(pid_t pid)
|
||||
|
||||
if (!pid)
|
||||
{
|
||||
tcb = (struct tcb_s *)g_readytorun.head;
|
||||
tcb = this_task();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -44,10 +44,6 @@
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -70,7 +66,7 @@
|
||||
|
||||
FAR struct socketlist *sched_getsockets(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
DEBUGASSERT(group);
|
||||
|
||||
@@ -41,10 +41,6 @@
|
||||
#include <sched.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -69,7 +65,7 @@
|
||||
|
||||
FAR struct streamlist *sched_getstreams(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
DEBUGASSERT(group);
|
||||
|
||||
@@ -45,30 +45,6 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functionss
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -93,7 +69,7 @@
|
||||
|
||||
int sched_lock(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* Check for some special cases: (1) rtcb may be NULL only during
|
||||
* early boot-up phases, and (2) sched_lock() should have no
|
||||
|
||||
@@ -43,30 +43,6 @@
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functionss
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -91,7 +67,6 @@
|
||||
|
||||
int sched_lockcount(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
return (int)rtcb->lockcount;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,26 +46,6 @@
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -102,7 +82,7 @@ bool sched_mergepending(void)
|
||||
|
||||
/* Initialize the inner search loop */
|
||||
|
||||
rtrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtrtcb = this_task();
|
||||
|
||||
/* Process every TCB in the g_pendingtasks list */
|
||||
|
||||
|
||||
@@ -58,18 +58,6 @@
|
||||
# define CONFIG_SCHED_CPULOAD_TIMECONSTANT 2
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -92,7 +80,7 @@
|
||||
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
|
||||
static inline void sched_process_scheduler(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
/* Check if the currently executing task uses round robin scheduling. */
|
||||
|
||||
@@ -91,7 +91,7 @@ int sched_rr_get_interval(pid_t pid, struct timespec *interval)
|
||||
|
||||
if (!pid)
|
||||
{
|
||||
rrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rrtcb = this_task();
|
||||
}
|
||||
|
||||
/* Return a special error code on invalid PID */
|
||||
|
||||
@@ -41,26 +41,6 @@
|
||||
#include <sched.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -77,7 +57,5 @@
|
||||
|
||||
FAR struct tcb_s *sched_self(void)
|
||||
{
|
||||
return (FAR struct tcb_s *)g_readytorun.head;
|
||||
return this_task();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param)
|
||||
|
||||
/* Check if the task to reprioritize is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if (pid == 0 || pid == rtcb->pid)
|
||||
{
|
||||
tcb = rtcb;
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
tstate_t task_state;
|
||||
irqstate_t saved_state;
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ static struct timespec g_stop_time;
|
||||
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
|
||||
static inline uint32_t sched_process_scheduler(uint32_t ticks, bool noswitches)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ntcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct tcb_s *ntcb = this_task();
|
||||
uint32_t ret = 0;
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
@@ -212,7 +212,7 @@ static inline uint32_t sched_process_scheduler(uint32_t ticks, bool noswitches)
|
||||
* the new task at the head of the ready to run list.
|
||||
*/
|
||||
|
||||
ntcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
ntcb = this_task();
|
||||
|
||||
/* Check if the new task at the head of the ready-to-run has changed. */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user