mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
sched_lock: remove the check for whether tcb is NULL
Remove Redundant Checks Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -76,13 +76,13 @@ void sched_lock(void)
|
|||||||
* integer type.
|
* integer type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(rtcb == NULL || rtcb->lockcount < MAX_LOCK_COUNT);
|
DEBUGASSERT(rtcb && rtcb->lockcount < MAX_LOCK_COUNT);
|
||||||
|
|
||||||
/* A counter is used to support locking. This allows nested lock
|
/* A counter is used to support locking. This allows nested lock
|
||||||
* operations on this thread (on any CPU)
|
* operations on this thread (on any CPU)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (rtcb != NULL && rtcb->lockcount++ == 0)
|
if (rtcb->lockcount++ == 0)
|
||||||
{
|
{
|
||||||
#if (CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0) || \
|
#if (CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0) || \
|
||||||
defined(CONFIG_SCHED_INSTRUMENTATION_PREEMPTION)
|
defined(CONFIG_SCHED_INSTRUMENTATION_PREEMPTION)
|
||||||
|
|||||||
@@ -64,13 +64,13 @@ void sched_unlock(void)
|
|||||||
|
|
||||||
/* rtcb may be NULL only during early boot-up phases */
|
/* rtcb may be NULL only during early boot-up phases */
|
||||||
|
|
||||||
DEBUGASSERT(rtcb == NULL || rtcb->lockcount > 0);
|
DEBUGASSERT(rtcb && rtcb->lockcount > 0);
|
||||||
|
|
||||||
/* Check if the lock counter has decremented to zero. If so,
|
/* Check if the lock counter has decremented to zero. If so,
|
||||||
* then pre-emption has been re-enabled.
|
* then pre-emption has been re-enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (rtcb != NULL && rtcb->lockcount == 1)
|
if (rtcb->lockcount == 1)
|
||||||
{
|
{
|
||||||
irqstate_t flags = enter_critical_section_wo_note();
|
irqstate_t flags = enter_critical_section_wo_note();
|
||||||
FAR struct tcb_s *ptcb;
|
FAR struct tcb_s *ptcb;
|
||||||
|
|||||||
Reference in New Issue
Block a user