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

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

?? async.msgqueue.html

?? PTypes (C++ Portable Types Library) is a simple alternative to the STL that includes multithreading
?? HTML
字號:
<html><!-- #BeginTemplate "/Templates/tmpl.dwt" --><head><!-- #BeginEditable "doctitle" --> <title>PTypes: multithreading: msgqueue</title><!-- #EndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="styles.css"></head><body bgcolor="#FFFFFF" leftmargin="40" marginwidth="40"><p><a href="../index.html"><img src="title-1.7.gif" width="213" height="34" alt="C++ Portable Types Library (PTypes) Version 1.7" border="0"></a> <hr noshade><!-- #BeginEditable "body" --> <p class="hpath"><a href="index.html">Top</a>: <a href="async.html">Multithreading</a>: msgqueue </p><blockquote> <pre class="lang">#include &lt;pasync.h&gt;msgqueue::msgqueue();<span class="comment">// functions calling from the owner thread:</span>int msgqueue::msgsavail()void msgqueue::processone();void msgqueue::processmsgs();void msgqueue::run();<span class="comment">// functions calling from any thread:</span>void msgqueue::post(message* msg);void msgqueue::post(int id, int param = 0);void msgqueue::posturgent(message* msg);void msgqueue::posturgent(int id, int param = 0);int msgqueue::send(message* msg);int msgqueue::send(int id, int param = 0);<span class="comment">// message handlers</span>virtual void msgqueue::msghandler(message& msg) = 0;void msgqueue::defhandler(message& msg);</pre></blockquote><p><span class="lang">Msgqueue</span> class implements a queue of <a href="async.message.html">message</a> objects and is typically used to synchronously exchange data in a multithreaded environment. Unlike Windows, you can create as many message queues in your application as you want. </p><p>The thread which created the msgqueue object can retrieve messages from the queue using one of <span class="lang">run()</span>, <span class="lang">processmsgs()</span>, <span class="lang">processone()</span>. Applications always define a class derived from msgqueue and override the pure virtual method <span class="lang">msghandler()</span>. The overridden method receives message structures and performs appropriate actions. Any other thread or even multiple threads in your application can send or post messages to the given queue using <span class="lang">post()</span>, <span class="lang">posturgent()</span> or <span class="lang">send()</span>.</p><p><span class="lang">Msgqueue</span> can serve as a synchronization object between threads. Unlike semaphores, where both sending and receiving threads can &quot;hang&quot; when waiting for readiness of the peer, <span class="lang">msgqueue</span> allows the sender to send data and immediately continue the execution. The receiver in its turn processes messages one by one in the same order as they were posted. </p><p>Threads can not only exchange data through a message queue, but also send simple notifications about various events. Message queues can even be used in single-threaded applications with event-driven logic.</p><p>A simple example of using <span class="lang">msgqueue</span> could be a server application with multiple threads, each serving one client; the server maintains a log file where it records various events. To record events synchronously, the client threads are sending appropriate messages to the main thread. The client threads never waste time, they just post their messages and immediately continue their work.</p><p>The maximum number of unhandled messages in the queue is currently set to 65535. If the limit is reached, a fatal (unrecoverable) error will be raised and the application will terminate.</p><p>A slower but more universal and flexible alternative to the message queue is local pipe (see <a href="streams.infile.html">infile::pipe()</a>).</p><p><span class="def">msgqueue::msgqueue()</span> constructs a message queue object. It doesn't matter which thread is creating this object, but later only one thread can process the queue and handle messages.</p><p><span class="def">int msgqueue::msgsavail()</span> returns the number of messages currently in the queue.</p><p><span class="def">void msgqueue::processone() </span>processes one message from the queue. This method may &quot;hang&quot; if no messages are available. <span class="lang">processone()</span> calls the overridden <span class="lang">msghandler()</span> and then destroys the message object.</p><p><span class="def">void msgqueue::processmsgs()</span> processes all messages in the queue and returns to the caller. If there are no messages in the queue, <span class="lang">processmsgs()</span> returns immediately. Each message is processed as described for <span class="lang">processone()</span>.</p><p><span class="def">void msgqueue::run()</span> enters an infinite loop of message processing which can only be terminated by sending or posting a special message MSG_QUIT (e.g. <span class="lang">post(MSG_QUIT)</span>). Each message is processed as described for <span class="lang">processone()</span>.</p><p><span class="def">void msgqueue::post(message* msg)</span> adds a message to the queue. <span class="lang">Msg</span> can be an object of class <span class="lang">message</span> or any derivative class. The <span class="lang">message</span> object should always be created dynamically using operator <span class="lang">new</span>. The messages in the queue are processed in order they were posted, i.e. on first-in-first-out basis. <span class="lang">post()</span> can be called from any thread, including the thread owning the queue.</p><p><span class="def">void msgqueue::post(int id, int param = 0)</span> creates a message object using <span class="lang">id</span> and <span class="lang">param</span> and calls <span class="lang">post(message*)</span>.</p><p><span class="def">void msgqueue::posturgent(message* msg)</span> posts a message object &quot;out of turn&quot;, i.e. this message will be processed first. The messages posted through this method are processed on first-in-last-out basis. <span class="lang">post()</span> and <span class="lang">posturgent()</span> can be used alternately on the same queue. Like <span class="lang">post()</span>, this method can be called from any thread.</p><p><span class="def">void msgqueue::posturgent(int id, int param = 0)</span> creates a message object using <span class="lang">id</span> and <span class="lang">param</span> and calls <span class="lang">posturgent(message*)</span>.</p><p><span class="def">int msgqueue::send(message* msg)</span> calls the message handler directly, by-passing the queue. If the sender is the same as the thread owning the queue, <span class="lang">send()</span> simply calls <span class="lang">msghandler()</span>. Otherwise, if the sender is a concurrent thread, <span class="lang">send()</span> enters an effective wait state until the message is processed by the owner thread. The return value is the value of <span class="lang">result</span> in the message object. In both cases the message is destroyed upon return from <span class="lang">send()</span>.</p><p><span class="def">int msgqueue::send(int id, int param = 0)</span> creates a message object using <span class="lang">id</span> and <span class="lang">param</span> and calls <span class="lang">send(message*)</span>. The return value is the value of <span class="lang">result</span> in the message object.</p><p><span class="def">virtual void msgqueue::msghandler(message& msg)</span> this pure virtual method should be overridden to provide application-specific message handling functionality. <span class="lang">msghandler()</span> usually checks the message ID through a <span class="lang">switch</span> statement. If the message ID is unknown to the application, <span class="lang">defhandler()</span> should be called. The message object <span class="lang">msg</span> CAN NOT be reused with <span class="lang">post()</span>, <span class="lang">posturgent()</span> or <span class="lang">send()</span>, neither it can be destroyed within the message handler. The message handler can assign some value to <span class="lang">msg.result</span> to return a simple answer to the caller of <span class="lang">send()</span>.</p><p><span class="def">void msgqueue::defhandler(message& msg)</span> is called from within user-defined <span class="lang">msghandler()</span> when the message ID is unknown to the application. <span class="lang">defhandler()</span> processes some messages internally used by the library, e.g. MSG_QUIT.</p><p class="seealso">See also: <a href="async.message.html">message</a>, <a href="async.examples.html">Examples</a></p><span class="lang"></span><!-- #EndEditable --><hr size="1"><a href="../index.html" class="ns">PTypes home</a></body><!-- #EndTemplate --></html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久亚区不卡日本| 日韩国产精品久久久| 日韩电影在线看| 粉嫩aⅴ一区二区三区四区| 欧美午夜影院一区| 国产精品久久久久桃色tv| 五月激情丁香一区二区三区| eeuss鲁片一区二区三区| 日韩亚洲欧美综合| 一区二区中文字幕在线| 国产乱一区二区| 91精品国产高清一区二区三区| 中文字幕综合网| 丁香激情综合五月| 久久综合999| 免费在线观看日韩欧美| 欧美亚洲自拍偷拍| 国产精品午夜久久| 国产在线视频精品一区| 欧美精品在线观看一区二区| 亚洲综合色区另类av| av男人天堂一区| 欧美国产日本韩| 美女免费视频一区二区| 91精品国产免费久久综合| 亚洲午夜精品17c| 色视频成人在线观看免| 久久久久久9999| 国产在线精品一区二区三区不卡| 欧美精品18+| 日韩精品每日更新| 欧美午夜精品久久久| 亚洲欧美在线观看| www.爱久久.com| 亚洲精品中文字幕在线观看| 色综合视频在线观看| 亚洲色图欧美激情| 91在线播放网址| 亚洲一区欧美一区| 欧美日韩国产精选| 青青草精品视频| 欧美xxxx在线观看| 国产精品夜夜嗨| 国产精品美女久久久久久久久久久| 国产成人夜色高潮福利影视| 国产欧美一区二区精品忘忧草| 高清免费成人av| 中文字幕日本不卡| 欧美性感一区二区三区| 偷窥国产亚洲免费视频| 日韩午夜小视频| 韩国欧美一区二区| 国产精品美女久久久久久久久 | 天天综合色天天综合| 欧美精品一二三四| 久久99精品一区二区三区三区| 久久亚洲免费视频| www.久久精品| 日韩电影在线观看一区| 国产亚洲美州欧州综合国| 成人毛片视频在线观看| 亚洲欧美电影院| 欧美顶级少妇做爰| 蜜臀va亚洲va欧美va天堂| 精品国产精品网麻豆系列| 国产91丝袜在线18| 一区二区高清在线| 91精品在线观看入口| 粉嫩嫩av羞羞动漫久久久 | 国产喷白浆一区二区三区| 91香蕉视频mp4| 男女激情视频一区| 国产精品久久久久久久岛一牛影视 | 精品视频一区三区九区| 亚洲国产成人av网| 欧美国产在线观看| 6080亚洲精品一区二区| 国产高清无密码一区二区三区| 国产精品国产自产拍高清av | 国产精品无圣光一区二区| 欧美午夜影院一区| 成人午夜激情在线| 日本欧美在线观看| 一区二区三区中文字幕在线观看| 久久免费的精品国产v∧| 欧美日韩一区精品| 99久久精品久久久久久清纯| 久久国产日韩欧美精品| 亚洲一区二区三区视频在线| 国产色产综合色产在线视频| 欧美一级黄色片| 欧美色欧美亚洲另类二区| 风间由美一区二区av101| 日韩制服丝袜先锋影音| 亚洲男人天堂av| 国产欧美一区二区三区网站| 精品乱人伦小说| 欧美精品久久一区| 91极品视觉盛宴| av福利精品导航| 成人国产精品免费网站| 国产一区二区精品在线观看| 蜜桃视频第一区免费观看| 亚洲尤物视频在线| 亚洲欧美日韩综合aⅴ视频| 国产偷国产偷精品高清尤物| 日韩精品影音先锋| 日韩欧美一区在线| 欧美剧情片在线观看| 欧美性大战久久| 色乱码一区二区三区88| 97久久精品人人爽人人爽蜜臀| 国产福利精品一区二区| 国产一区二区三区在线观看免费视频| 日本中文字幕一区二区视频 | 亚洲免费视频成人| 亚洲欧洲色图综合| 1024成人网| 中文字幕欧美一| 亚洲色图欧美激情| 亚洲综合精品久久| 亚洲大片在线观看| 五月天激情综合| 久久精品国产精品青草| 久久国产精品第一页| 久久国产生活片100| 国产一区二区三区久久久 | 老司机免费视频一区二区| 久久国内精品自在自线400部| 美美哒免费高清在线观看视频一区二区 | 精品久久久久久最新网址| 精品久久久久一区二区国产| 久久久无码精品亚洲日韩按摩| 337p日本欧洲亚洲大胆色噜噜| 久久一区二区视频| 一区二区中文字幕在线| 亚洲福中文字幕伊人影院| 日韩电影在线一区二区| 九色综合狠狠综合久久| 国产电影一区二区三区| 97久久精品人人澡人人爽| 欧美日韩精品免费| 精品1区2区在线观看| 国产精品久久久久久亚洲伦| 亚洲精品国产成人久久av盗摄| 日韩精品一级中文字幕精品视频免费观看| 麻豆国产精品777777在线| 国产东北露脸精品视频| 欧美亚洲国产一区在线观看网站 | 欧美在线短视频| 日韩精品专区在线影院观看| 欧美激情中文不卡| 午夜欧美2019年伦理| 国产成人在线网站| 欧美日韩国产天堂| 国产女人18水真多18精品一级做| 亚洲欧美日韩国产另类专区| 日韩电影免费在线看| 成人激情文学综合网| 欧美日本在线看| 国产精品视频yy9299一区| 天堂午夜影视日韩欧美一区二区| 国产乱码精品一品二品| 欧美日韩国产高清一区| 欧美极品aⅴ影院| 日本特黄久久久高潮| 成人av网在线| 精品国产一区二区三区忘忧草| 亚洲色图清纯唯美| 国产精品资源网站| 日韩一区二区在线免费观看| 一区二区在线观看视频在线观看| 狠狠色狠狠色合久久伊人| 欧美性xxxxxxxx| 中文字幕一区二区不卡| 激情综合网av| 91精品国产色综合久久ai换脸 | 久久精品国产色蜜蜜麻豆| 欧美色网一区二区| 国产精品美女久久久久av爽李琼| 免费成人av在线播放| 在线不卡免费av| 亚洲免费在线观看| 成人精品在线视频观看| 久久一区二区三区国产精品| 久久精品国产亚洲aⅴ| 欧美日韩在线三区| 一区二区三区免费网站| 91在线精品一区二区三区| 久久久精品国产免大香伊| 精品一区二区三区免费观看 | 欧美午夜理伦三级在线观看| 18涩涩午夜精品.www| 国产电影精品久久禁18| 久久久久久夜精品精品免费| 国产在线视视频有精品| 久久久久97国产精华液好用吗| 美女国产一区二区三区| 日韩精品一区二区三区swag| 美腿丝袜在线亚洲一区 |