diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index c0b4a15067..953f5eea10 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -437,6 +437,10 @@ Other memory: * Corrected memory leak in OS pthread join logic * Corrected memory leaks in examples/ostest due to failures to join or detach from pthreads. + * added pthread_once(), pthread_kill(), pthread_sigmask() + * added pthread_barrierattr_*() APIs + * added pthread_barrier_init(), pthread_barrier_destroy(), and + pthread_barrier_wait(); * Started m68322 diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index 18a33b93a8..883da65c3d 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -573,7 +573,7 @@ other tasks with the same priority. @@ -616,7 +616,7 @@ of the task specified by pid. @@ -655,7 +655,7 @@ interface of the same name. priority of the calling task is set.
  • policy. Scheduling policy requested (either SCHED_FIFO or SCHED_RR). -
  • param. A structure whose member sched_priority is the +
  • param.
  • A structure whose member sched_priority is the integer priority. The range of valid priority numbers is from SCHED_PRIORITY_MIN through SCHED_PRIORITY_MAX. @@ -3096,6 +3096,7 @@ be sent. Only positive, non-zero values of pid are supported by this implementation. ID of the task to receive signal
  • signo. The signal number to send. + If signo is zero, no signal is sent, but all error checking is performed.

    @@ -3163,6 +3164,16 @@ be sent.

  • 2.9.40 pthread_cond_signal
  • 2.9.41 pthread_cond_wait
  • 2.9.42 pthread_cond_timedwait
  • +
  • 2.9.43 pthread_barrierattr_init
  • +
  • 2.9.44 pthread_barrierattr_destroy
  • +
  • 2.9.45 pthread_barrierattr_setpshared
  • +
  • 2.9.46 pthread_barrierattr_getpshared
  • +
  • 2.9.47 pthread_barrier_init
  • +
  • 2.9.48 pthread_barrier_destroy
  • +
  • 2.9.49 pthread_barrier_wait
  • +
  • 2.9.50 pthread_once
  • +
  • 2.9.51 pthread_kill
  • +
  • 2.9.52 pthread_sigmask
  • 2.9.1 pthread_attr_init

    @@ -3181,7 +3192,7 @@ for all of the individual attributes used by the implementation. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3213,7 +3224,7 @@ An attributes object can be deleted when it is no longer needed. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3244,7 +3255,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3275,7 +3286,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3307,7 +3318,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3339,7 +3350,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3371,7 +3382,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3403,7 +3414,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3434,7 +3445,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3465,7 +3476,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3504,7 +3515,7 @@ specify details about the kind of thread being created. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3537,7 +3548,7 @@ return value and completion status will not be requested. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3569,7 +3580,7 @@ A thread may terminate it's own execution. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3698,7 +3709,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3731,7 +3742,7 @@ the return value of the thread. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3764,7 +3775,7 @@ made available. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3796,7 +3807,7 @@ A thread may obtain a copy of its own thread handle. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3828,7 +3839,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -3860,7 +3871,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4069,7 +4080,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4100,7 +4111,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4132,7 +4143,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4164,7 +4175,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4196,7 +4207,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4227,7 +4238,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4258,7 +4269,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4289,7 +4300,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4320,7 +4331,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4351,7 +4362,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4382,7 +4393,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4413,7 +4424,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4444,7 +4455,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4475,7 +4486,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4506,7 +4517,7 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    Returned Values: @@ -4537,10 +4548,10 @@ interface of the same name. Input Parameters:

      -
    • parm +
    • param.

    -Returned Values: + Returned Values:

    If successful, the pthread_cond_wait() function will return zero (OK). Otherwise, an error number will be @@ -4555,38 +4566,513 @@ returned to indicate the error: interface of the same name.

    2.9.42 pthread_cond_timedwait

    -

    -Function Prototype: -

    -

    +

    + Function Prototype: +

    +
         #include <pthread.h>
         int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
     				  const struct timespec *abstime);
    -
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • parm -
    -

    -Returned Values: -

    -If successful, the pthread_cond_timedwait() function will return -zero (OK). Otherwise, an error number will be -returned to indicate the error: -

    -

      +
    +

    + Description: +

    +

    + Input Parameters: +

    +

    +

      +
    • parm.
    • +
    +

    + Returned Values: +

    +

    + If successful, the pthread_cond_timedwait() function will return + zero (OK). Otherwise, an error number will be + returned to indicate the error: +

    +
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX -interface of the same name. + +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.43 pthread_barrierattr_init

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr);
    +
    +

    + Description: + The pthread_barrierattr_init() function will initialize a barrier + attribute object attr with the default value for all of the attributes + defined by the implementation. +

    +

    + Input Parameters: +

    +
      +
    • + attr. Barrier attributes to be initialized. +
    • +
    +

    + Returned Values: + 0 (OK) on success or EINVAL if attr is invalid. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.44 pthread_barrierattr_destroy

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr);
    +
    +

    + Description: + The pthread_barrierattr_destroy() function will destroy a barrier attributes object. + A destroyed attributes object can be reinitialized using pthread_barrierattr_init(); + the results of otherwise referencing the object after it has been destroyed are undefined. +

    +

    + Input Parameters: +

    +
      +
    • + attr. Barrier attributes to be destroyed. +
    • +
    +

    + Returned Values: 0 (OK) on success or EINVAL if attr is invalid. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.45 pthread_barrierattr_setpshared

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared);
    +
    +

    + Description: + The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit + a barrier to be operated upon by any thread that has access to the memory where the + barrier is allocated. + If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, the barrier can + only be operated upon by threads created within the same process as the thread that + initialized the barrier. + If threads of different processes attempt to operate on such a barrier, the behavior is undefined. + The default value of the attribute is PTHREAD_PROCESS_PRIVATE. +

    +

    + Input Parameters: +

    +
      +
    • attr. Barrier attributes to be modified.
    • +
    • pshared. The new value of the pshared attribute.
    • +
    +

    + Returned Values: 0 (OK) on success or EINVAL if either + attr is invalid or pshared is not one of + PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.46 pthread_barrierattr_getpshared

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR int *pshared);
    +
    +

    + Description: + The pthread_barrierattr_getpshared() function will obtain the value of the + process-shared attribute from the attributes object referenced by attr. +

    +

    + Input Parameters: +

    +

    +

      +
    • attr. Barrier attributes to be queried.
    • +
    • pshared. The location to stored the current value of the pshared attribute.
    • +
    +

    + Returned Values: 0 (OK) on success or EINVAL if + either attr or pshared is invalid. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.47 pthread_barrier_init

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrier_init(FAR pthread_barrier_t *barrier,
    +                             FAR const pthread_barrierattr_t *attr, unsigned int count);
    +
    +

    + 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. +

    +

    + Input 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. +
    • +
    +

    + Returned Values: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. +
    • +
    • + ENOMEM. + Insufficient memory exists to initialize the barrier. +
    • +
    • + EBUSY. + The implementation has detected an attempt to reinitialize a barrier while it is in use. +
    • +
    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.48 pthread_barrier_destroy

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrier_destroy(FAR pthread_barrier_t *barrier);
    +
    +

    + Description: + The pthread_barrier_destroy() function destroys the barrier referenced + by barrie 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. +

    +

    + Input Parameters: +

    +
      +
    • barrier. The barrier to be destroyed.
    • +
    +

    + Returned Values: 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. +
    • +
    • + EINVAL. + The value specified by barrier is invalid. +
    • +
    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.49 pthread_barrier_wait

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_barrier_wait(FAR pthread_barrier_t *barrier);
    +
    +

    + 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 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. +

    +

    + 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. +

    +

    + Input Parameters: +

    +
      +
    • barrier. The barrier on which to wait.
    • +
    +

    + Returned Values: 0 (OK) on success or EINVAL if the barrier is not valid. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + + +

    2.9.50 pthread_once

    +

    + Function Prototype: +

    +
    +    #include <pthread.h>
    +    int pthread_once(FAR pthread_once_t *once_control, CODE void (*init_routine)(void));
    +
    +

    + 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. +

    +

    + Input Parameters: +

    +

    +

      +
    • + once_control. + Determines if init_routine() should be called. + once_control should be declared and intialized as follows: +
        pthread_once_t once_control = PTHREAD_ONCE_INIT;
        +    
      + PTHREAD_ONCE_INIT is defined in pthread.h. +
    • +
    • + init_routine. + The initialization routine that will be called once. +
    • +
    +

    + Returned Values: + 0 (OK) on success or EINVAL if either once_control or init_routine are invalid. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.51 pthread_kill

    +

    + Function Prototype: +

    +
    +    #include <signal.h>
    +    #include <pthread.h>
    +    int pthread_kill(pthread_t thread, int signo)
    +
    +

    + Description: + The pthread_kill() system call can be used to send any + signal to a thread. See kill() for further information + as this is just a simple wrapper around the kill() + function. +

    +

    + Input Parameters: +

    +

    +

      +
    • + thread. + The id of the thread to receive the signal. Only positive, non-zero values of tthreadt are supported. +
    • +
    • + signo. + The signal number to send. If signo is zero, no signal is sent, but all error checking is performed. +
    • +
    +

    + Returned Values: +

    +

    + On success, the signal was sent and zero is returned. + On error one of the following error numbers is returned. +

    +
      +
    • + EINVAL. + An invalid signal was specified. +
    • +
    • + EPERM. + The thread does not have permission to send the signal to the target thread. +
    • +
    • + ESRCH. + No thread could be found corresponding to that specified by the given thread ID. +
    • +
    • + ENOSYS. + Do not support sending signals to process groups. +
    • +
    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    + +

    2.9.52 pthread_sigmask

    +

    + Function Prototype: +

    +
    +    #include <signal.h>
    +    #include <pthread.h>
    +    int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
    +
    +

    + Description: + This function is a simple wrapper around sigprocmask(). + See the sigprocmask() function description for further information. +

    +

    + Input Parameters: +

    +

    +

      +
    • + how. How the signal mast will be changed: +
        +
      • + SIG_BLOCK: + The resulting set is the union of the current set and the signal set pointed to by set. +
      • +
      • + SIG_UNBLOCK: + The resulting set is the intersection of the current set and the complement of the signal set pointed to by set. +
      • +
      • + SIG_SETMASK: + The resulting set is the signal set pointed to by set. +
      • +
      +
    • +
    • + set. Location of the new signal mask. +
    • +
    • + oset. Location to store the old signal mask. +
    • +
    +

    + Returned Values: +

    +

    + 0 (OK) on succes or EINVAL if how is invalid. +

    +

    + Assumptions/Limitations: +

    +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. +

    -


    3.0 OS Data Structures

    3.1 Scalar types

    @@ -4897,6 +5383,7 @@ notify a task when a message is available on a queue.
  • mq_setattr
  • mq_unlink
  • OS Interfaces +
  • Pthread Interfaces
  • pthread_attr_destroy
  • pthread_attr_getinheritsched
  • pthread_attr_getschedparam
  • @@ -4907,6 +5394,13 @@ notify a task when a message is available on a queue.
  • pthread_attr_setschedparam
  • pthread_attr_setschedpolicy
  • pthread_attr_setstacksize
  • +
  • pthread_barrierattr_init
  • +
  • pthread_barrierattr_destroy
  • +
  • pthread_barrierattr_getpshared
  • +
  • pthread_barrierattr_setpshared
  • +
  • pthread_barrier_destroy
  • +
  • pthread_barrier_init
  • +
  • pthread_barrier_wait
  • pthread_cancel
  • pthread_condattr_init
  • pthread_cond_broadcast
  • @@ -4924,6 +5418,7 @@ notify a task when a message is available on a queue.
  • pthread_join
  • pthread_key_create
  • pthread_key_delete
  • +
  • pthread_kill
  • pthread_mutexattr_destroy
  • pthread_mutexattr_getpshared
  • pthread_mutexattr_init
  • @@ -4934,11 +5429,12 @@ notify a task when a message is available on a queue.
  • pthread_mutex_trylock
  • pthread_mutex_unlock
  • pthread_condattr_destroy
  • -
  • Pthread Interfaces +
  • pthread_once
  • pthread_self
  • pthread_setcancelstate
  • pthread_setschedparam
  • pthread_setspecific
  • +
  • pthread_sigmask
  • pthread_testcancelstate
  • pthread_yield
  • sched_getparam