### NAME

  rt_send - send a message

### SYNOPSIS

  #include "rtai_sched.h"

  RT_TASK* rt_send (RT_TASK* task, unsigned int msg);

### DESCRIPTION

  rt_send sends the message msg to the task task. If the receiver task is ready to get the message rt_send returns immediately. Otherwise the caller task is blocked and queued up. (Queueing may happen in priority order or on FIFO base. This is determined by compile time option MSG_PRIORD.)

### RETURN VALUE

  On success, task (the pointer to the task that received the message) is returned. If the caller is unblocked but message has not been sent (e.g. the task task was killed before receiving the message) 0 is returned. On other failure, a special value is returned as described below.

### ERRORS

  `0`
    The receiver task was killed before receiving the message.
  `0xffff`
    task does not refer to a valid task.

### BUGS

  There is no guarantee, that the value of pointer task cannot be `0xffff`. In this theoretical case the caller cannot figure out if the operation was succesful or not.

[return to index]

### NAME

  rt_send_if - send a message if possible

### SYNOPSIS

  #include "rtai_sched.h"

  RT_TASK* rt_send_if (RT_TASK* task, unsigned int msg);

### DESCRIPTION

  rt_send_if tries to send the message msg to the task task. The caller task is never blocked.

### RETURN VALUE

  On success, task (the pointer to the task that received the message) is returned. If message has not been sent, 0 is returned. On other failure, a special value is returned as described below.

### ERRORS

  `0`
    The task task was not ready to receive the message.
  `0xffff`
    task does not refer to a valid task.

### BUGS

  There is no guarantee, that the value of pointer task cannot be `0xffff`. In this theoretical case the caller cannot figure out if the operation was succesful or not.

[return to index]

### NAME

  rt_send_until, rt_send_timed - send a message with timeout

### SYNOPSIS

  #include "rtai_sched.h"

  RT_TASK* rt_send_until (RT_TASK* task, unsigned int msg, RTIME time);

  RT_TASK* rt_send_timed (RT_TASK* task, unsigned int msg, RTIME delay);

### DESCRIPTION

  rt_send_until and rt_send_timed send the message msg to the task task. If the receiver task is ready to get the message these functions return immediately. Otherwise the caller task is blocked and queued up. (Queueing may happen in priority order or on FIFO base. This is determined by compile time option MSG_PRIORD.) In this case these functions return if
  - The caller task is in the first place of the waiting queue and the receiver gets the message;
  - Timeout occurs;
  - An error occurs (e.g. the receiver task is killed);
  time is an absolute value. delay is relative to the current time.

### RETURN VALUE

  On success, task (the pointer to the task that received the message) is returned. If message has not been sent, 0 is returned. On other failure, a special value is returned as described below.

### ERRORS

  `0`
    Operation timed out, message was not delivered.
  `0xffff`
    task does not refer to a valid task.

### BUGS

  There is no guarantee, that the value of pointer task cannot be `0xffff`. In this theoretical case the caller cannot figure out if the operation was succesful or not.

[return to index]

### NAME

  rt_receive - receive a message

### SYNOPSIS

  #include "rtai_sched.h"

  RT_TASK* rt_receive (RT_TASK* task, unsigned int *msg);

### DESCRIPTION

  rt_receive gets a message from the task specified by task. If task is equal to 0, the caller accepts message from any task. If there is a pending message, rt_receive returns immediately. Otherwise the caller task is blocked and queued up. (Queueing may happen in priority order or on FIFO base. This is determined by compile time option MSG_PRIORD.)
  msg points to a buffer provided by the caller.

### RETURN VALUE

  On success, a pointer to the sender task is returned. If the caller is unblocked but no message has been received (e.g. the task task was killed before sending the message) 0 is returned. On other failure, a special value is returned as described below.

### ERRORS

  `0`
    The sender task was killed before sending the message.
  `0xffff`
    task does not refer to a valid task.

### BUGS

  There is no guarantee, that the value of returned task pointer cannot be `0xffff`. In this theoretical case the caller cannot figure out if the operation was succesful or not.

[return to index]

### NAME

  rt_receive_if - receive a message if possible

### SYNOPSIS

  #include "rtai_sched.h"

  RT_TASK* rt_receive_if (RT_TASK* task, unsigned int *msg);

### DESCRIPTION

  rt_receive_if tries to get a message from the task specified by task. If task is equal to 0, the caller accepts message from any task. The caller task is never blocked.
  msg points to a buffer provided by the caller.

### RETURN VALUE

  On success, a pointer to the sender task is returned. If no message has been received, 0 is returned. On other failure, a special value is returned as described below.

### ERRORS

  `0`
    There was no message to receive.
  `0xffff`
    task does not refer to a valid task.

### BUGS

  There is no guarantee, that the value of returned task pointer cannot be `0xffff`. In this theoretical case the caller cannot figure out if the operation was succesful or not.

[return to index]

### NAME

  rt_receive_until, rt_receive_timed - receive a message with timeout

### SYNOPSIS

  #include "rtai_sched.h"

  RT_TASK* rt_receive_until (RT_TASK* task, unsigned int *msg, RTIME time);

  RT_TASK* rt_receive_timed (RT_TASK* task, unsigned int *msg, RTIME delay);

### DESCRIPTION

  rt_receive_until and rt_receive_timed receive a message from the task specified by task. If task is equal to 0, the caller accepts message from any task. If there is a pending message, these functions return immediately. Otherwise the caller task is blocked and queued up. (Queueing may happen in priority order or on FIFO base. This is determined by compile time option MSG_PRIORD.) In this case these functions return if
  - The caller task is in the first place of the waiting queue and the sender sends a message;
  - Timeout occurs;
  - An error occurs (e.g. the sender task is killed);
  msg points to a buffer provided by the caller.
  time is an absolute value. delay is relative to the current time.

### RETURN VALUE

  On success, a pointer to the sender task is returned. If no message has been received, 0 is returned. On other failure, a special value is returned as described below.

### ERRORS

  `0`
    Operation timed out, no message was received.
  `0xffff`
    task does not refer to a valid task.

### BUGS

  There is no guarantee, that the value of returned task pointer cannot be `0xffff`. In this theoretical case the caller cannot figure out if the operation was succesful or not.

[return to index]