RT_SEM_WAIT(2)

NAME
rt_sem_wait - semaphore 'wait' operation (with blocking)

SYNOPSIS
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include rt_ipc.h

int rt_sem_wait(rt_sem_t *sem, RTIME timeout);

DESCRIPTION
rt_sem_wait is the semaphore wait (sometimes known as 'take' or 'P') operation. Unlike with rt_sem_trywait, if the semaphore is not available, the calling task blocks until it is. sem points to the structure used in the call to rt_sem_create. An optional timeout can be specified. If timeout is RT_WAIT_FOREVER, the function does not time out. If timeout is RT_NO_WAIT and the semaphore is not available, rt_sem_wait returns immediately. If timeout is any other value, it represent a time at which the call to rt_sem_wait should time out. If that time is reached, rt_sem_wait returns with -ETIME.

RETURN VALUE
On success, 0 is returned. On failure, a negative value is returned as described below.

ERRORS

-ETIME
    The timeout period expired.

-EINVAL
    sem does not point to a valid rt_sem_t.

AUTHOR
Jerry Epplin <JerryEpplin@worldnet.att.net>

SEE ALSO
rt_task_ipc_delete(2), rt_task_ipc_init(2), rt_sem_destroy(2), rt_sem_init(2), rt_sem_post(2), rt_sem_trywait(2)