mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
sched/: Various fixes for typos, improved parameter verification.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* sched/pthread/pthread_setschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008, 2012, 2015, 2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -105,10 +106,6 @@ int pthread_setschedparam(pthread_t thread, int policy,
|
||||
|
||||
sinfo("thread ID=%d policy=%d param=0x%p\n", thread, policy, param);
|
||||
|
||||
/* Set the errno to some non-zero value (failsafe) */
|
||||
|
||||
set_errno(EINVAL);
|
||||
|
||||
/* Let sched_setscheduler do all of the work */
|
||||
|
||||
ret = sched_setscheduler((pid_t)thread, policy, param);
|
||||
|
||||
+5
-1
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/sched/sched.h
|
||||
*
|
||||
* Copyright (C) 2007-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2014, 2016, 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -63,6 +63,10 @@
|
||||
* tasks built into the design).
|
||||
*/
|
||||
|
||||
#if CONFIG_MAX_TASKS & (CONFIG_MAX_TASKS - 1)
|
||||
# error CONFIG_MAX_TASKS must be power of 2
|
||||
#endif
|
||||
|
||||
#define MAX_TASKS_MASK (CONFIG_MAX_TASKS-1)
|
||||
#define PIDHASH(pid) ((pid) & MAX_TASKS_MASK)
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ void nxsem_recover(FAR struct tcb_s *tcb)
|
||||
nxsem_canceled(tcb, sem);
|
||||
|
||||
/* And increment the count on the semaphore. This releases the count
|
||||
* that was taken by sem_post(). This count decremented the semaphore
|
||||
* that was taken by sem_wait(). This count decremented the semaphore
|
||||
* count to negative and caused the thread to be blocked in the first
|
||||
* place.
|
||||
*/
|
||||
|
||||
@@ -103,11 +103,11 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
/* Allocate a new task group with privileges appropriate for the parent
|
||||
* thread type.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
ret = group_allocate(tcb, ttype);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -157,9 +157,9 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
|
||||
|
||||
(void)task_argsetup(tcb, name, argv);
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
/* Now we have enough in place that we can join the group */
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
ret = group_initialize(tcb);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: task_setcancelstate
|
||||
* Name: task_setcanceltype
|
||||
*
|
||||
* Description:
|
||||
* The task_setcanceltype() function atomically both sets the calling
|
||||
|
||||
+10
-4
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* sched/wdog/wd_delete.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2016, 2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -113,9 +114,7 @@ int wd_delete(WDOG_ID wdog)
|
||||
sched_kfree(wdog);
|
||||
}
|
||||
|
||||
/* This was a pre-allocated timer. This function should not be called for
|
||||
* statically allocated timers.
|
||||
*/
|
||||
/* Check if this is pre-allocated timer. */
|
||||
|
||||
else if (!WDOG_ISSTATIC(wdog))
|
||||
{
|
||||
@@ -129,6 +128,13 @@ int wd_delete(WDOG_ID wdog)
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/* This function should not be called for statically allocated timers. */
|
||||
|
||||
else
|
||||
{
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/* Return success */
|
||||
|
||||
return OK;
|
||||
|
||||
Reference in New Issue
Block a user