Reference

rt_sem_init(2)

create a semaphore

NAME

rt_sem_init - create a semaphore

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_init(rt_sem_t *sem, RT_SEMTYPE type, int init_val);

DESCRIPTION

rt_sem_init is called to initialize a real-time semaphore. A semaphore can be used for communication and synchronization among real-time tasks. Communication between Linux processes and real-time tasks is done using the standard Real-Time Linux RT-FIFO facilities.

sem must point to a statically allocated structure. type is RT_SEM_BINARY or RT_SEM_COUNTING. init_val is the initial value of the semaphore (usually 0).

RETURN VALUE

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

ERRORS

-EINVAL

init_val is negative (or type is RT_SEM_BINARY, and init_val is greater than one.

BUGS

Priority inheritance is not currently supported.

AUTHOR

Jerry Epplin <[email protected]>

SEE ALSO

rt_task_ipc_delete(2), rt_task_ipc_init(2), rt_sem_destroy(2), rt_sem_post(2), rt_sem_trywait(2), rt_sem_wait(2)