sched/task_terminate always return an error because return value was not being set correctory. From Gosha
This commit is contained in:
parent
1fcd2bfd10
commit
3be307bc25
@ -6586,4 +6586,6 @@
|
||||
connecting to a server (2014-2-15).
|
||||
* The basic SAMD20 Xplained Pro port is complete but still untested
|
||||
(2014-2-16).
|
||||
* sched/task_terminate.c: Always returns an error because the
|
||||
return value was not being set correctly. From Gosha (2014-2-18).
|
||||
|
||||
|
@ -852,7 +852,7 @@ Configuration sub-directories
|
||||
|
||||
STATUS/ISSUES:
|
||||
|
||||
1. The FLASH waistates is set to 2 (see include/board.h). According to
|
||||
1. The FLASH waitstates is set to 2 (see include/board.h). According to
|
||||
the data sheet, it should work at 1 but I sometimes see crashes when
|
||||
the waitstates are set to one (about half of the time) (2014-2-18).
|
||||
|
||||
@ -860,7 +860,7 @@ Configuration sub-directories
|
||||
the time) or after a power cycle (less after a power cycle). I don't
|
||||
understand the cause of of this but most of this can be eliminated by
|
||||
simply holding the the reset button longer and releasing it cleanly
|
||||
(then it fails maybe 5-10% of the time, mabe because of button
|
||||
(then it fails maybe 5-10% of the time, maybe because of button
|
||||
chatter?) (2014-2-18).
|
||||
|
||||
- The garbage is not random: It is always the same.
|
||||
|
@ -198,4 +198,3 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/task_exit.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2012-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -105,6 +105,7 @@ int task_exit(void)
|
||||
{
|
||||
FAR struct tcb_s *dtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb;
|
||||
int ret;
|
||||
|
||||
/* Remove the TCB of the current task from the ready-to-run list. A context
|
||||
* switch will definitely be necessary -- that must be done by the
|
||||
@ -136,7 +137,7 @@ int task_exit(void)
|
||||
*/
|
||||
|
||||
sched_addblocked(dtcb, TSTATE_TASK_INACTIVE);
|
||||
task_terminate(dtcb->pid, true);
|
||||
ret = task_terminate(dtcb->pid, true);
|
||||
rtcb->task_state = TSTATE_TASK_RUNNING;
|
||||
|
||||
/* If there are any pending tasks, then add them to the ready-to-run
|
||||
@ -157,5 +158,5 @@ int task_exit(void)
|
||||
*/
|
||||
|
||||
rtcb->lockcount--;
|
||||
return OK;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/task_terminate.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -42,6 +42,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
#include <queue.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <arch/irq.h>
|
||||
@ -123,7 +124,6 @@ int task_terminate(pid_t pid, bool nonblocking)
|
||||
{
|
||||
FAR struct tcb_s *dtcb;
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
||||
/* Make sure the task does not become ready-to-run while we are futzing with
|
||||
* its TCB by locking ourselves as the executing task.
|
||||
@ -131,15 +131,15 @@ int task_terminate(pid_t pid, bool nonblocking)
|
||||
|
||||
sched_lock();
|
||||
|
||||
/* Find for the TCB associated with matching pid */
|
||||
/* Find for the TCB associated with matching PID */
|
||||
|
||||
dtcb = sched_gettcb(pid);
|
||||
if (!dtcb)
|
||||
{
|
||||
/* This pid does not correspond to any known task */
|
||||
/* This PID does not correspond to any known task */
|
||||
|
||||
sched_unlock();
|
||||
return ERROR;
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
/* Verify our internal sanity */
|
||||
@ -184,6 +184,5 @@ int task_terminate(pid_t pid, bool nonblocking)
|
||||
|
||||
/* Deallocate its TCB */
|
||||
|
||||
sched_releasetcb(dtcb, dtcb->flags & TCB_FLAG_TTYPE_MASK);
|
||||
return ret;
|
||||
return sched_releasetcb(dtcb, dtcb->flags & TCB_FLAG_TTYPE_MASK);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user