mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 18:58:27 +08:00
sched/: Review and correct some stylistic inconsistencies
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/pthread/pthread_barriedestroy.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -44,20 +44,21 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: pthread_barrier_destroy
|
||||
*
|
||||
* Description:
|
||||
* The pthread_barrier_destroy() function destroys the barrier referenced by
|
||||
* 'barrier' and releases any resources used by the barrier. The effect of
|
||||
* subsequent use of the barrier is undefined until the barrier is
|
||||
* reinitialized by another call to pthread_barrier_init(). The results are
|
||||
* undefined if pthread_barrier_destroy() is called when any thread is blocked
|
||||
* on the barrier, or if this function is called with an uninitialized barrier.
|
||||
* The pthread_barrier_destroy() function destroys the barrier referenced
|
||||
* by 'barrier' and releases any resources used by the barrier. The effect
|
||||
* of subsequent use of the barrier is undefined until the barrier is
|
||||
* reinitialized by another call to pthread_barrier_init(). The result
|
||||
* are undefined if pthread_barrier_destroy() is called when any thread is
|
||||
* blocked on the barrier, or if this function is called with an
|
||||
* uninitialized barrier.
|
||||
*
|
||||
* Parameters:
|
||||
* barrier - barrier to be destroyed.
|
||||
@@ -65,13 +66,13 @@
|
||||
* Return Value:
|
||||
* 0 (OK) on success or on of the following error numbers:
|
||||
*
|
||||
* EBUSY The implementation has detected an attempt to destroy a barrier while
|
||||
* it is in use.
|
||||
* EBUSY The implementation has detected an attempt to destroy a barrier
|
||||
* while it is in use.
|
||||
* EINVAL The value specified by barrier is invalid.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_barrier_destroy(FAR pthread_barrier_t *barrier)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/pthread/pthread_barrieinit.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -44,44 +44,45 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: pthread_barrier_init
|
||||
*
|
||||
* Description:
|
||||
* The pthread_barrier_init() function allocates any resources required to use
|
||||
* the barrier referenced by 'barrier' and initialized the barrier with the
|
||||
* attributes referenced by attr. If attr is NULL, the default barrier
|
||||
* attributes will be used. The results are undefined if pthread_barrier_init()
|
||||
* is called when any thread is blocked on the barrier. The results are
|
||||
* undefined if a barrier is used without first being initialized. The results
|
||||
* are undefined if pthread_barrier_init() is called specifying an already
|
||||
* initialized barrier.
|
||||
* The pthread_barrier_init() function allocates any resources required to
|
||||
* use the barrier referenced by 'barrier' and initialized the barrier
|
||||
* with the attributes referenced by attr. If attr is NULL, the default
|
||||
* barrier attributes will be used. The results are undefined if
|
||||
* pthread_barrier_init() is called when any thread is blocked on the
|
||||
* barrier. The results are undefined if a barrier is used without first
|
||||
* being initialized. The results are undefined if pthread_barrier_init()
|
||||
* is called specifying an already initialized barrier.
|
||||
*
|
||||
* Parameters:
|
||||
* barrier - the barrier to be initialized
|
||||
* attr - barrier attributes to be used in the initialization.
|
||||
* count - the count to be associated with the barrier. The count argument
|
||||
* specifies the number of threads that must call pthread_barrier_wait() before
|
||||
* any of them successfully return from the call. The value specified by
|
||||
* count must be greater than zero.
|
||||
* count - the count to be associated with the barrier. The count
|
||||
* argument specifies the number of threads that must call
|
||||
* pthread_barrier_wait() before any of them successfully return from
|
||||
* the call. The value specified by count must be greater than zero.
|
||||
*
|
||||
* Return Value:
|
||||
* 0 (OK) on success or on of the following error numbers:
|
||||
*
|
||||
* EAGAIN The system lacks the necessary resources to initialize another barrier.
|
||||
* EINVAL The barrier reference is invalid, or the values specified by attr are
|
||||
* invalid, or the value specified by count is equal to zero.
|
||||
* EAGAIN The system lacks the necessary resources to initialize another
|
||||
* barrier. EINVAL The barrier reference is invalid, or the values
|
||||
* specified by attr are invalid, or the value specified by count
|
||||
* is equal to zero.
|
||||
* ENOMEM Insufficient memory exists to initialize the barrier.
|
||||
* EBUSY The implementation has detected an attempt to reinitialize a barrier
|
||||
* while it is in use.
|
||||
* EBUSY The implementation has detected an attempt to reinitialize a
|
||||
* barrier while it is in use.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_barrier_init(FAR pthread_barrier_t *barrier,
|
||||
FAR const pthread_barrierattr_t *attr, unsigned int count)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/pthread/pthread_barrierwait.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2014 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -45,41 +45,43 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: pthread_barrier_wait
|
||||
*
|
||||
* Description:
|
||||
* The pthread_barrier_wait() function synchronizse participating threads at
|
||||
* the barrier referenced by 'barrier'. The calling thread is blocked until
|
||||
* the required number of threads have called pthread_barrier_wait() specifying
|
||||
* the same 'barrier'. When the required number of threads have called
|
||||
* pthread_barrier_wait() specifying the 'barrier', the constant
|
||||
* PTHREAD_BARRIER_SERIAL_THREAD will be returned to one unspecified thread
|
||||
* and zero will be returned to each of the remaining threads. At this point,
|
||||
* the barrier will be reset to the state it had as a result of the most recent
|
||||
* pthread_barrier_init() function that referenced it.
|
||||
* The pthread_barrier_wait() function synchronizse participating threads
|
||||
* at the barrier referenced by 'barrier'. The calling thread is blocked
|
||||
* until the required number of threads have called pthread_barrier_wait()
|
||||
* specifying the same 'barrier'. When the required number of threads
|
||||
* have called pthread_barrier_wait() specifying the 'barrier', the
|
||||
* constant PTHREAD_BARRIER_SERIAL_THREAD will be returned to one
|
||||
* unspecified thread and zero will be returned to each of the remaining
|
||||
* threads. At this point, the barrier will be reset to the state it had
|
||||
* as a result of the most recent pthread_barrier_init() function that
|
||||
* referenced it.
|
||||
*
|
||||
* The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in pthread.h and its
|
||||
* value must be distinct from any other value returned by pthread_barrier_wait().
|
||||
* The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in pthread.h and
|
||||
* its value must be distinct from any other value returned by
|
||||
* pthread_barrier_wait().
|
||||
*
|
||||
* The results are undefined if this function is called with an uninitialized
|
||||
* barrier.
|
||||
* The results are undefined if this function is called with an
|
||||
* uninitialized barrier.
|
||||
*
|
||||
* If a signal is delivered to a thread blocked on a barrier, upon return from
|
||||
* the signal handler the thread will resume waiting at the barrier if the barrier
|
||||
* wait has not completed; otherwise, the thread will continue as normal from
|
||||
* the completed barrier wait. Until the thread in the signal handler returns
|
||||
* from it, it is unspecified whether other threads may proceed past the barrier
|
||||
* once they have all reached it.
|
||||
* If a signal is delivered to a thread blocked on a barrier, upon return
|
||||
* from the signal handler the thread will resume waiting at the barrier
|
||||
* if the barrier wait has not completed; otherwise, the thread will
|
||||
* continue as normal from the completed barrier wait. Until the thread in
|
||||
* the signal handler returns from it, it is unspecified whether other
|
||||
* threads may proceed past the barrier once they have all reached it.
|
||||
*
|
||||
* A thread that has blocked on a barrier will not prevent any unblocked thread
|
||||
* that is eligible to use the same processing resources from eventually making
|
||||
* forward progress in its execution. Eligibility for processing resources will
|
||||
* be determined by the scheduling policy.
|
||||
* A thread that has blocked on a barrier will not prevent any unblocked
|
||||
* thread that is eligible to use the same processing resources from
|
||||
* eventually making forward progress in its execution. Eligibility for
|
||||
* processing resources will be determined by the scheduling policy.
|
||||
*
|
||||
* Parameters:
|
||||
* barrier - the barrier to wait on
|
||||
@@ -89,7 +91,7 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* pthread_findjoininfo.c
|
||||
* sched/pthread/pthread_findjoininfo.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* pthread_getaffinity.c
|
||||
* sched/pthread/pthread_getaffinity.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* pthread_getschedparam.c
|
||||
* sched/pthread/pthread_getschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* pthread_join.c
|
||||
* sched/pthread/pthread_join.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/pthread/pthread_once.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
@@ -45,26 +45,26 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: pthread_once
|
||||
*
|
||||
* Description:
|
||||
* The first call to pthread_once() by any thread with a given once_control,
|
||||
* will call the init_routine with no arguments. Subsequent calls to
|
||||
* pthread_once() with the same once_control will have no effect. On return
|
||||
* from pthread_once(), init_routine will have completed.
|
||||
* The first call to pthread_once() by any thread with a given
|
||||
* once_control, will call the init_routine with no arguments. Subsequent
|
||||
* calls to pthread_once() with the same once_control will have no effect.
|
||||
* On return from pthread_once(), init_routine will have completed.
|
||||
*
|
||||
* Parameters:
|
||||
* once_control - Determines if init_routine should be called. once_control
|
||||
* should be declared and initializeed as follows:
|
||||
* once_control - Determines if init_routine should be called.
|
||||
* once_control should be declared and initializeed as follows:
|
||||
*
|
||||
* pthread_once_t once_control = PTHREAD_ONCE_INIT;
|
||||
*
|
||||
* PTHREAD_ONCE_INIT is defined in pthread.h
|
||||
* PTHREAD_ONCE_INIT is defined in pthread.h
|
||||
* init_routine - The initialization routine that will be called once.
|
||||
*
|
||||
* Return Value:
|
||||
@@ -73,7 +73,7 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_once(FAR pthread_once_t *once_control,
|
||||
CODE void (*init_routine)(void))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/******************************************************************************************
|
||||
/****************************************************************************
|
||||
* sched/pthread/pthread_setcancelstate.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
@@ -31,23 +31,23 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/******************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
******************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/******************************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
******************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/******************************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: pthread_setcancelstate
|
||||
******************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_setcancelstate(int state, FAR int *oldstate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user