thread_post_many Subroutine

Purpose

Posts one or more threads of an event completion.

Library

Standard C library (libc.a)

Syntax

#include <sys/thread.h>

int thread_post_many( nthreads, tidp, erridp)
int nthreads;
tid_t * tidp;
tid_t * erridp;

Description

The thread_post_many subroutine posts one or more threads of the occurrence of the event. The number of threads to be posted is specified by the value of the nthreads parameter, while the tidp parameter points to an array of thread IDs of threads that need to be posted. The subroutine works just like the thread_post subroutine but can be used to post to multiple threads at the same time.

A maximum of 512 threads can be posted in one call to the thread_post_many subroutine.

An optional address to a thread ID field may be passed in the erridp parameter. This field is normally ignored by the kernel unless the subroutine fails because the calling process has no permissions to post to any one of the specified threads. In this case, the kernel posts all threads in the array pointed at by the tidp parameter up to the first failing thread and fills the erridp parameter with the failing thread's ID.

Parameters

Item Description
nthreads Specifies the number of threads to be posted.
tidp Specifies the address of an array of thread IDs corresponding to the list of threads to be posted.
erridp Either NULL or specifies the pointer to a thread ID variable in which the kernel will return the thread ID of the first failing thread when an errno of EPERM is set.

Return Values

On successful completion, the thread_post_many subroutine returns a value of 0. If unsuccessful, a value of -1 is returned and the global variable errno is set to indicate the error.

Error Codes

The thread_post_many subroutine is unsuccessful when one of the following is true:
Item Description
ESRCH None of the indicated threads are existent or they have all exited or are exiting.
EPERM The real or effective user ID does not match the real or effective user ID of one or more threads being posted, or else the calling process does not have root user authority.
EFAULT The tidp parameter points to a location outside of the address space of the process.
EINVAL A negative value or a value greater than 512 was was specified in the nthreads parameter.