亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? real-time experiment #4 message queues.htm

?? 該文檔是學習在Vxworks上進行編程開發的入門教材。
?? HTM
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0069)http://www.rt.db.erau.edu/experiments/vx/mesgQueues/Experiment-4.html -->
<HTML><HEAD><TITLE>Real-Time Experiment #4: Message Queues</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>ticks 
<CENTER>
<H1>Embry-Riddle Real-Time Laboratory Experiment<BR>Experiment #4<BR>Message 
Queues </H1></CENTER>
<HR SIZE=3>

<H2>Introduction</H2>
<P></P>In VxWorks, the primary intertask communication mechanism within a single 
CPU is <EM>message queues</EM>. Message queues allow a variable number of 
messages, each of variable length, to be queued(FIFO or priority based). Any 
task can send a message to a message queue and any task can receive a message 
from a message queue. Multiple tasks can send to and receive from the same 
message queue. Two way communication between two tasks generally requires two 
message queues, one for each direction.
<P></P>
<HR SIZE=3>

<H2>Objectives</H2>The following are the primary objectives of this experiment: 
<UL>
  <LI>To demonstrate the use of VxWorks message queues. </LI></UL>
<P></P>
<HR SIZE=3>

<H2>Description</H2>Wind message queues are created and deleted with the 
following routines: 
<UL>
  <LI><EM>msgQCreate(int maxMsgs, int maxMsgLength, int options)</EM>: Allocate 
  and initialize a message queue. </LI></UL>
<UL>
  <LI><EM>msgQDelete(MSG_Q_ID msgQId)</EM>: Terminate and free a message queue. 
  </LI></UL>
<UL>
  <LI><EM>msgQSend(MSG_Q_ID msgQId, char *Buffer, UINT nBytes, int timeout, int 
  priority)</EM>: Send a message to a message queue. </LI></UL>
<UL>
  <LI><EM>msgQReceive(MSG_Q_ID msgQId, char *Buffer, UINT nBytes, int 
  timeout)</EM> Send a message to a message queue. </LI></UL>This library provides 
messages that are queued in FIFO order, with a single exception: there are two 
priority levels, and messages marked as high priority are attached to the head 
of the queue.
<P></P>A message queue is created with <EM>msgQCreate()</EM>. Its parameters 
specify the maximum number of messages that can be queued in the message queue 
and the maximum length in bytes of each message.
<P></P>A task sends a message to a message queue with <EM>msgQSend()</EM>. If no 
tasks are waiting for messages on that queue, the message is added to the 
queue's buffer of messages. If any tasks are waiting for a message from that 
message queue, the message is immediately delivered to the first waiting task.
<P></P>A task receives a message from a message queue with 
<EM>msgQReceive()</EM>. If messages are already available in the queue's buffer, 
the first message is immediately dequeued and returned to the caller. If no 
messages are available, then the calling task blocks and is added to a queue of 
tasks waiting for messages. The queue of waiting tasks can be ordered either by 
task priority or FIFO, as specified when the queue is created. 
<P></P>
<UL>
  <LI><EM><B>Timeouts</B></EM>: Both <EM>msgQSend()</EM> and 
  <EM>msgQReceive()</EM> take timeout parameters. The timeout parameter 
  specifies how many ticks(clock ticks per second) to wait for space to be 
  available when sending a message and to wait for a message to be available 
  when receiving a message. </LI></UL>
<UL>
  <LI><EM><B>Urgent Messages</B></EM>: The <EM>msgQSend()</EM> function can 
  specify the priority of a message either as normal <B>MSG_PRI_NORMAL</B> or 
  urgent <B>MSG_PRI_URGENT</B>. Normal priority messages are added to the tail 
  of the message queue, while urgent priority messages are added to the head of 
  the message queue. </LI></UL>
<P></P><B>1. Example</B>
<P></P><PRE>-------------------------------------------------------------------------------------
/* includes */
#include "vxWorks.h"
#include "msgQLib.h"

/* function prototypes */
void taskOne(void);
void taskTwo(void);

/* defines */
#define MAX_MESSAGES 100
#define MAX_MESSAGE_LENGTH 50

/* globals */
MSG_Q_ID mesgQueueId;

void message(void) /* function to create the message queue and two tasks */
{
int taskIdOne, taskIdTwo;

/* create message queue */
if ((mesgQueueId = msgQCreate(MAX_MESSAGES,MAX_MESSAGE_LENGTH,MSG_Q_FIFO))
	== NULL)
	printf("msgQCreate in failed\n");


/* spawn the two tasks that will use the message queue */
if((taskIdOne = taskSpawn("t1",90,0x100,2000,(FUNCPTR)taskOne,0,0,0,0,0,0,0,
	0,0,0)) == ERROR)
	printf("taskSpawn taskOne failed\n");
if((taskIdTwo = taskSpawn("t2",90,0x100,2000,(FUNCPTR)taskTwo,0,0,0,0,0,0,0,
	0,0,0)) == ERROR)
	printf("taskSpawn taskTwo failed\n");
}


void taskOne(void) /* task that writes to the message queue */
{
char message[] = "Received message from taskOne";

/* send message */
if((msgQSend(mesgQueueId,message,MAX_MESSAGE_LENGTH, WAIT_FOREVER, 
	MSG_PRI_NORMAL)) == ERROR)
	printf("msgQSend in taskOne failed\n");
}

void taskTwo(void) /* tasks that reads from the message queue */
{
char msgBuf[MAX_MESSAGE_LENGTH];

/* receive message */
if(msgQReceive(mesgQueueId,msgBuf,MAX_MESSAGE_LENGTH, WAIT_FOREVER) 
		== ERROR)
	printf("msgQReceive in taskTwo failed\n");	
else
		printf("%s\n",msgBuf); 
msgQDelete(mesgQueueId); /* delete message queue */
}
-------------------------------------------------------------------------------------
</PRE>
<P></P>
<HR SIZE=3>

<H2>Procedures</H2>1. Copy the source code in the example and compile it. 
<P></P>2. Load the object file onto the target machine.
<P></P>3. Run the examples by executing the main routine("message") of the 
example on WindSh terminal. 
<P></P>Note: Make sure you have redirected I/O, otherwise you won't see the 
results of the printf commands. 
<HR SIZE=3>

<H2>Follow On Experiment</H2>Experiment 1. Modify the above program so that 
taskTwo can send a string message ("Received message from taskTwo") to taskOne. 
Have taskOne print the message sent from taskTwo.
<P></P>Experiment 2. Are there any advantages or disadvantages to using message 
queues as opposed to global variables as a message passing scheme? Explain your 
answer.
<P></P>
<HR SIZE=3>

<H2>Additional Information</H2>Refer to VxWorks User's Manual and Reference 
Manual.
<P></P>
<HR SIZE=3>

<CENTER>
<H4><A 
href="http://www.rt.db.erau.edu/experiments/vx/toc/TableOfContents.html">Return 
to Primary Table of Contents </A></H4></CENTER>
<HR SIZE=3>

<CENTER>Last Updated: 17 March 1997<BR><EM>Created by: Dan Eyassu</EM><BR><A 
href="mailto:eyassud@db.erau.edu">eyassud@db.erau.edu</A><BR></CENTER></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合色综合色综合| 午夜不卡av在线| 一区二区三区免费看视频| 亚洲18影院在线观看| 韩日精品视频一区| 成人av电影观看| 欧美日韩综合色| 精品国产制服丝袜高跟| 亚洲天堂免费看| 免费在线观看日韩欧美| jizzjizzjizz欧美| 欧美一二三四区在线| 久久久久国产精品人| 一区二区三区在线视频播放| 美女网站视频久久| 92国产精品观看| 日韩一区二区电影| 亚洲免费伊人电影| 精品午夜一区二区三区在线观看| 99v久久综合狠狠综合久久| 欧美一区二区在线观看| 国产精品久久久久四虎| 日本va欧美va瓶| 91蜜桃网址入口| www精品美女久久久tv| 亚洲一二三区在线观看| 国产成人av网站| 欧美一区二区三区视频在线| ...xxx性欧美| 国产麻豆成人精品| 欧美精品日韩精品| 亚洲人成精品久久久久| 国产麻豆成人传媒免费观看| 5858s免费视频成人| 中文字幕乱码亚洲精品一区 | 在线亚洲人成电影网站色www| 精品日韩在线观看| 亚洲成av人在线观看| www.亚洲在线| 久久九九全国免费| 美女网站色91| 欧美精品在线视频| 一区二区三区国产精华| 成人av免费在线观看| 精品99一区二区| 日本美女视频一区二区| 欧美性猛交xxxx黑人交| 日韩一区日韩二区| 成人性生交大片免费看视频在线| 精品美女被调教视频大全网站| 亚洲一区二区成人在线观看| 91原创在线视频| 国产精品久久看| 粉嫩一区二区三区在线看| 精品久久久久香蕉网| 日本免费新一区视频| 欧美高清一级片在线| 亚洲成人动漫一区| 欧美午夜电影网| 一区二区三区不卡视频| 99久久777色| 综合精品久久久| www.亚洲色图.com| 中文字幕在线视频一区| 成人app网站| 国产精品理论片| 99久久免费精品高清特色大片| 欧美激情中文不卡| 国产成+人+日韩+欧美+亚洲| 久久女同性恋中文字幕| 国精产品一区一区三区mba桃花 | 日韩国产欧美三级| 欧美电影在线免费观看| 三级成人在线视频| 91精品国产色综合久久久蜜香臀| 日日噜噜夜夜狠狠视频欧美人| 欧美日韩成人综合天天影院 | 日韩女优制服丝袜电影| 蜜芽一区二区三区| 欧美不卡一区二区| 国产精品夜夜嗨| 国产欧美一区二区三区鸳鸯浴 | 国产精品久久久久久久裸模 | 亚洲欧美日韩成人高清在线一区| 91色.com| 午夜精品久久久久久久久久| 欧美久久久久久蜜桃| 奇米精品一区二区三区在线观看 | 午夜视频在线观看一区二区三区| 欧美日韩综合一区| 日韩二区三区四区| 久久综合九色综合97婷婷| 国产精品一区二区你懂的| 国产精品区一区二区三| 日本高清不卡视频| 日韩电影免费在线观看网站| 精品免费日韩av| 成人综合婷婷国产精品久久蜜臀 | 99精品久久久久久| 亚洲国产一区二区在线播放| 56国语精品自产拍在线观看| 激情欧美日韩一区二区| 国产精品久久久久桃色tv| 91成人在线免费观看| 免费高清视频精品| 国产午夜亚洲精品理论片色戒| aaa亚洲精品一二三区| 亚洲成人免费看| 精品成人一区二区三区| av中文一区二区三区| 亚洲大片精品永久免费| 亚洲精品一线二线三线| av一区二区三区在线| 五月天国产精品| 国产亚洲一本大道中文在线| 在线一区二区三区四区| 精品在线播放免费| 亚洲九九爱视频| 精品久久人人做人人爰| 91在线一区二区三区| 卡一卡二国产精品| 亚洲少妇30p| 欧美成va人片在线观看| 一本色道**综合亚洲精品蜜桃冫 | 三级久久三级久久| 国产日本欧美一区二区| 欧美日韩亚州综合| 成人视屏免费看| 男女男精品视频| 亚洲精品视频在线观看网站| 欧美成人一区二区三区片免费| 99久久精品免费看| 久久精品国产精品亚洲综合| 亚洲欧美日韩国产手机在线| 久久这里都是精品| 欧美久久久久中文字幕| jizzjizzjizz欧美| 久久av老司机精品网站导航| 亚洲综合久久久| 国产精品久久三区| 精品国产伦一区二区三区观看方式| 色综合咪咪久久| 国产成人av电影在线| 蜜桃在线一区二区三区| 亚洲综合图片区| 国产精品久久毛片a| 久久影院视频免费| 91精品国产91热久久久做人人| 91无套直看片红桃| 国产成人激情av| 精品亚洲aⅴ乱码一区二区三区| 亚洲电影中文字幕在线观看| 国产精品久久久久久户外露出| 精品国产sm最大网站免费看| 91精品久久久久久久91蜜桃| 日本高清免费不卡视频| www.日韩大片| 国产精品69毛片高清亚洲| 美国三级日本三级久久99 | 91精品国产一区二区三区香蕉| 91麻豆精东视频| youjizz久久| 波多野结衣精品在线| 国产成人精品免费| 国产精品一区不卡| 经典一区二区三区| 麻豆久久久久久久| 天堂一区二区在线| 五月天激情小说综合| 性做久久久久久| 亚洲成人在线观看视频| 亚洲一区二区五区| 亚洲一区二区欧美日韩| 一区二区三区av电影| 一区二区三区欧美视频| 一区二区视频在线| 亚洲六月丁香色婷婷综合久久| 亚洲欧洲性图库| 成人免费在线视频| 国产九色sp调教91| 国产又粗又猛又爽又黄91精品| 卡一卡二国产精品| 国产一区在线不卡| 国产精品18久久久久久久久久久久| 激情综合网天天干| 国产精品18久久久久久vr| 国产精品资源在线| 盗摄精品av一区二区三区| 成人av电影免费在线播放| 99久久婷婷国产精品综合| 色综合久久天天综合网| 在线亚洲高清视频| 欧美精选午夜久久久乱码6080| 91麻豆精品国产91久久久资源速度| 91精品国产色综合久久ai换脸| 日韩精品一区二| 久久久天堂av| 国产精品乱码一区二区三区软件 | 成a人片国产精品| 91国偷自产一区二区三区成为亚洲经典|