thread_post Subroutine

Purpose

Posts a thread of an event completion.

Library

Standard C library (libc.a)

Syntax

#include <sys/thread.h>

int thread_post( tid)
tid_t  tid;

Description

The thread_post subroutine posts the thread whose thread ID is indicated by the value of the tid parameter, of the occurrence of an event. If the posted thread is waiting in thread_wait, it will be awakened immediately. If it not waiting in thread_wait, the next call to thread_wait does not block but returns with success immediately.

Multiple posts to the same thread without an intervening wait by the specified thread will only count as a single post. The posting remains in effect until the indicated thread calls the thread_wait subroutine upon which the posting gets cleared.

The thread_wait and the thread_post subroutine can be used by applications to implement a fast IPC mechanism between threads in different processes.

Parameters

Item Description
tid Specifies the thread ID of the thread to be posted.

Return Values

On successful completion, the thread_post 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

Item Description
ESRCH This indicated thread is non-existent or the thread has exited or is exiting.
EPERM The real or effective user ID does not match the real or effective user ID of the thread being posted, or else the calling process does not have root user authority.