mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Fix a test for valid scheduling policies
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* libc/pthread/pthread_attrsetschedpolicy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -45,26 +45,6 @@
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -92,11 +72,15 @@ int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy)
|
||||
|
||||
sdbg("attr=0x%p policy=%d\n", attr, policy);
|
||||
|
||||
if (!attr ||
|
||||
(policy != SCHED_FIFO
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
if (!attr || (policy != SCHED_FIFO && policy != SCHED_RR))
|
||||
#else
|
||||
if (!attr || policy != SCHED_FIFO )
|
||||
&& policy != SCHED_RR
|
||||
#endif
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
&& policy != SCHED_SPORADIC
|
||||
#endif
|
||||
))
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user