zephyr::raw

Function k_msgq_alloc_init

source
pub unsafe extern "C" fn k_msgq_alloc_init(
    msgq: *mut k_msgq,
    msg_size: usize,
    max_msgs: u32,
) -> i32
Expand description

@brief Initialize a message queue.

This routine initializes a message queue object, prior to its first use, allocating its internal ring buffer from the calling thread’s resource pool.

Memory allocated for the ring buffer can be released by calling k_msgq_cleanup(), or if userspace is enabled and the msgq object loses all of its references.

@param msgq Address of the message queue. @param msg_size Message size (in bytes). @param max_msgs Maximum number of messages that can be queued.

@return 0 on success, -ENOMEM if there was insufficient memory in the thread’s resource pool, or -EINVAL if the size parameters cause an integer overflow.