VxWorks Starter Notes-Message Queuing __buffer

Source: Internet
Author: User
Tags message queue
VxWorks Starter Notes-Message Queuing one. Concept:

1. Message Queuing is used to pass information between tasks.

2. Multiple tasks send or receive messages to the same message queue.

3.ISR can send messages in no_wait mode.

Two. Control function: 1. msgqcreate msg_q_id msgqcreate (int maxmsgs,/* Message Queue Length (maximum number of messages)/int maxmsglength,/* Maximum length of message in message queue */INT Options/* Fifo/priori TY waits for Task queue mode */)

2. Msgqsend

STATUS msgqsend (msg_q_id msgqid,/* Message queue ID/char *buffer,/* Pointer to the message to be sent/UINT nbytes,/* Message length */int timeout,/* Timeout (tick)/no-wait/forever */INT priority/* Msg_pri_normal or Msg_pri_urgent * *)

3.msgQReceive

int msgqreceive (msg_q_id msgqid,/* Message queue ID/char *buffer,/* Pointer to the receiving buffer of the message/UINT maxnbytes,/* Receive buffered bytes/int time Out/* Timeout time (tick)/no-wait/forever * *)

 

4. Msgqdelete

STATUS msgqdelete (msg_q_id msgqid/* ID of message queue to be deleted/*)

Once the Msgqdelete () operation completes, the task that is blocked on the message queue, including the task that is blocked on the send queue, the receive queue, is awakened (Unpend), and the ID of the message queue is no longer valid.

three. Recommendations:

1. Create a dedicated msgq for each task.

2. All message that needs to be sent to the task is sent to the only msgq.

3. Because Message Queuing has the Copy & MaxLength feature, we can only store pointers in Message Queuing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.