riot_sys

Function msg_send_receive

Source
pub unsafe extern "C" fn msg_send_receive(
    m: *mut msg_t,
    reply: *mut msg_t,
    target_pid: kernel_pid_t,
) -> c_int
Expand description

@brief Send a message, block until reply received.

This function sends a message to target_pid and then blocks until target has sent a reply which is then stored in reply. The responding thread must use @ref msg_reply().

Any incoming messages other than the reply are put into the queue (if one is configured), block the sender (if sent with @ref msg_send from a thread), or rejected (if sent with @ref msg_try_send or from an interrupt) – just like if the thread were blocked on anything different than message reception.

@pre @p target_pid is not the PID of the current thread.

@param[in] m Pointer to preallocated msg_t structure with the message to send, must not be NULL. @param[out] reply Pointer to preallocated msg. Reply will be written here, must not be NULL. Can be identical to @p m. @param[in] target_pid The PID of the target process

@return 1, if successful.