Skip to content
Snippets Groups Projects
Commit 9f80e4cc authored by Gregory Nutt's avatar Gregory Nutt
Browse files

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

parent 48355b32
No related branches found
No related tags found
No related merge requests found
/****************************************************************************
* 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);
......
/****************************************************************************
* 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
......
/****************************************************************************
* 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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment