sched/: Various fixes for typos, improved parameter verification.

This commit is contained in:
Gregory Nutt
2018-01-12 08:34:19 -06:00
parent 48355b32dc
commit 9f80e4ccf1
6 changed files with 21 additions and 14 deletions
+2 -5
View File
@@ -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
View File
@@ -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)
+1 -1
View File
@@ -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.
*/
+2 -2
View File
@@ -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)
{
+1 -1
View File
@@ -52,7 +52,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_setcancelstate
* Name: task_setcanceltype
*
* Description:
* The task_setcanceltype() function atomically both sets the calling
+10 -4
View File
@@ -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;