<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>庆亮的博客-webgame架构 &#187; 庆亮</title>
	<atom:link href="http://www.qingliangcn.com/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.qingliangcn.com</link>
	<description>关注LAMP&#124;PHP源代码分析&#124;web架构&#124;PHP扩展&#124;Erlang&#124;服务端架构</description>
	<lastBuildDate>Thu, 22 Jul 2010 09:19:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>空间更换到国外了</title>
		<link>http://www.qingliangcn.com/2010/07/%e7%a9%ba%e9%97%b4%e6%9b%b4%e6%8d%a2%e5%88%b0%e5%9b%bd%e5%a4%96%e4%ba%86/</link>
		<comments>http://www.qingliangcn.com/2010/07/%e7%a9%ba%e9%97%b4%e6%9b%b4%e6%8d%a2%e5%88%b0%e5%9b%bd%e5%a4%96%e4%ba%86/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 09:19:16 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=265</guid>
		<description><![CDATA[之前的合租空间不做了，现在换到国外了，速度上可能有点慢。]]></description>
			<content:encoded><![CDATA[<p>之前的合租空间不做了，现在换到国外了，速度上可能有点慢。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/07/%e7%a9%ba%e9%97%b4%e6%9b%b4%e6%8d%a2%e5%88%b0%e5%9b%bd%e5%a4%96%e4%ba%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GFW连http://www.python.org/download/都强掉了</title>
		<link>http://www.qingliangcn.com/2010/06/gfw%e8%bf%9ehttpwww-python-orgdownload%e9%83%bd%e5%bc%ba%e6%8e%89%e4%ba%86/</link>
		<comments>http://www.qingliangcn.com/2010/06/gfw%e8%bf%9ehttpwww-python-orgdownload%e9%83%bd%e5%bc%ba%e6%8e%89%e4%ba%86/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 06:41:08 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/2010/06/gfw%e8%bf%9ehttpwww-python-orgdownload%e9%83%bd%e5%bc%ba%e6%8e%89%e4%ba%86/</guid>
		<description><![CDATA[防民之口甚于防川]]></description>
			<content:encoded><![CDATA[<p>防民之口甚于防川</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/06/gfw%e8%bf%9ehttpwww-python-orgdownload%e9%83%bd%e5%bc%ba%e6%8e%89%e4%ba%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我的腾讯微博</title>
		<link>http://www.qingliangcn.com/2010/06/%e6%88%91%e7%9a%84%e8%85%be%e8%ae%af%e5%be%ae%e5%8d%9a/</link>
		<comments>http://www.qingliangcn.com/2010/06/%e6%88%91%e7%9a%84%e8%85%be%e8%ae%af%e5%be%ae%e5%8d%9a/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 02:24:25 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/2010/06/%e6%88%91%e7%9a%84%e8%85%be%e8%ae%af%e5%be%ae%e5%8d%9a/</guid>
		<description><![CDATA[t.qq.com/qingliangcn]]></description>
			<content:encoded><![CDATA[<p> t.qq.com/qingliangcn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/06/%e6%88%91%e7%9a%84%e8%85%be%e8%ae%af%e5%be%ae%e5%8d%9a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>R13B04的Emacs erlang-mode</title>
		<link>http://www.qingliangcn.com/2010/05/r13b04%e7%9a%84emacs-erlang-mode/</link>
		<comments>http://www.qingliangcn.com/2010/05/r13b04%e7%9a%84emacs-erlang-mode/#comments</comments>
		<pubDate>Fri, 21 May 2010 03:55:50 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[erlang-mode]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=260</guid>
		<description><![CDATA[R13B04的Emacs erlang-mode在编译后少了几个文件，默认%erlang_root%/lib/tools-2.6.5.1/emacs下有如下文件： &#160; -rw-r&#8211;r&#8211; 1 root root 183741 2010-05-21 11:43 erlang.el -rw-r&#8211;r&#8211; 1 root root &#160;10059 2010-05-21 11:43 erlang-eunit.el -rw-r&#8211;r&#8211; 1 root root &#160; 3452 2010-05-21 11:43 erlang-start.el -rw-r&#8211;r&#8211; 1 root root &#160; 1611 2010-05-21 11:43 README -rw-r&#8211;r&#8211; 1 root root &#160;12834 2010-05-21 11:43 test.erl.indented -rw-r&#8211;r&#8211; 1 root root &#160;11877 2010-05-21 11:43 test.erl.orig 直接在emacs中配置指向这里的话，会无法正常使用erlang-mode： (setq [...]]]></description>
			<content:encoded><![CDATA[<p>R13B04的Emacs erlang-mode在编译后少了几个文件，默认%erlang_root%/lib/tools-2.6.5.1/emacs下有如下文件：</p>
<p>&nbsp;</p>
<p>-rw-r&#8211;r&#8211; 1 root root 183741 2010-05-21 11:43 erlang.el</p>
<p>-rw-r&#8211;r&#8211; 1 root root &nbsp;10059 2010-05-21 11:43 erlang-eunit.el</p>
<p>-rw-r&#8211;r&#8211; 1 root root &nbsp; 3452 2010-05-21 11:43 erlang-start.el</p>
<p>-rw-r&#8211;r&#8211; 1 root root &nbsp; 1611 2010-05-21 11:43 README</p>
<p>-rw-r&#8211;r&#8211; 1 root root &nbsp;12834 2010-05-21 11:43 test.erl.indented</p>
<p>-rw-r&#8211;r&#8211; 1 root root &nbsp;11877 2010-05-21 11:43 test.erl.orig</p>
<div>直接在emacs中配置指向这里的话，会无法正常使用erlang-mode：</div>
<div>
<div><meta content="text/html; charset=utf-8" http-equiv="content-type" /></p>
<div>(setq load-path (cons &quot;/usr/local/erlang/lib/tools-2.6.5.1/emacs&quot; load-path))</div>
<div>&nbsp;</div>
<div>需要拷贝源代码目录中的emacs el文件过来，拷贝后如下：</div>
<div>
<div>-r-xr-xr-x 1 root root &nbsp;45795 2010-05-21 11:54 erlang_appwiz.el*</div>
<div>-rw-r&#8211;r&#8211; 1 root root 183741 2010-05-21 11:54 erlang.el</div>
<div>-rw-r&#8211;r&#8211; 1 root root &nbsp;10059 2010-05-21 11:54 erlang-eunit.el</div>
<div>-r-xr-xr-x 1 root root &nbsp;55313 2010-05-21 11:54 erlang-skels.el*</div>
<div>-r-xr-xr-x 1 root root &nbsp;48006 2010-05-21 11:54 erlang-skels-old.el*</div>
<div>-rw-r&#8211;r&#8211; 1 root root &nbsp; 3452 2010-05-21 11:54 erlang-start.el</div>
<div>-rw-r&#8211;r&#8211; 1 root root &nbsp; 1611 2010-05-21 11:43 README</div>
<div>-rw-r&#8211;r&#8211; 1 root root &nbsp;12834 2010-05-21 11:43 test.erl.indented</div>
<div>-rw-r&#8211;r&#8211; 1 root root &nbsp;11877 2010-05-21 11:43 test.erl.orig</div>
</p></div>
</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/05/r13b04%e7%9a%84emacs-erlang-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu下使用ntfs-config快速配置自动加载windows分区</title>
		<link>http://www.qingliangcn.com/2010/05/ubuntu%e4%b8%8b%e4%bd%bf%e7%94%a8ntfs-config%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae%e8%87%aa%e5%8a%a8%e5%8a%a0%e8%bd%bdwindows%e5%88%86%e5%8c%ba/</link>
		<comments>http://www.qingliangcn.com/2010/05/ubuntu%e4%b8%8b%e4%bd%bf%e7%94%a8ntfs-config%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae%e8%87%aa%e5%8a%a8%e5%8a%a0%e8%bd%bdwindows%e5%88%86%e5%8c%ba/#comments</comments>
		<pubDate>Wed, 19 May 2010 16:11:22 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Linux/Unix/BSD]]></category>
		<category><![CDATA[ntfs-config]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=258</guid>
		<description><![CDATA[apt-get install ntsf-config 恩，十分简单方便，记录以备查询。]]></description>
			<content:encoded><![CDATA[<p>apt-get install ntsf-config</p>
<p>恩，十分简单方便，记录以备查询。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/05/ubuntu%e4%b8%8b%e4%bd%bf%e7%94%a8ntfs-config%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae%e8%87%aa%e5%8a%a8%e5%8a%a0%e8%bd%bdwindows%e5%88%86%e5%8c%ba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mnesia脏读与事物读性能结果</title>
		<link>http://www.qingliangcn.com/2010/05/mnesia%e8%84%8f%e8%af%bb%e4%b8%8e%e4%ba%8b%e7%89%a9%e8%af%bb%e6%80%a7%e8%83%bd%e7%bb%93%e6%9e%9c/</link>
		<comments>http://www.qingliangcn.com/2010/05/mnesia%e8%84%8f%e8%af%bb%e4%b8%8e%e4%ba%8b%e7%89%a9%e8%af%bb%e6%80%a7%e8%83%bd%e7%bb%93%e6%9e%9c/#comments</comments>
		<pubDate>Thu, 13 May 2010 04:13:26 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[mnesia]]></category>
		<category><![CDATA[事务]]></category>
		<category><![CDATA[脏读]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=252</guid>
		<description><![CDATA[一直知道mnesia的事务比较慢，但慢到什么程度却没有一个数值的概念，今天正好有空测试一下。 上代码： -module(mnesia_read_test). -export([start/0, init_data/0, start2/0]). -record(r_test, {id, name}). start() -&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160; statistics(wall_clock), &#160;&#160;&#160; statistics(runtime), &#160; &#160;&#160;&#160;&#160;&#160;&#160;read(), &#160;&#160;&#160;&#160;&#160;&#160;&#160; {_, Time1} = statistics(wall_clock), &#160;&#160;&#160; {_, Time2} = statistics(runtime), &#160;&#160;&#160; io:format(&#34;times:~p, wall_clock ~p, runtime:~p&#34;, [100000, Time1, Time2]). &#160; start2() -&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160; statistics(wall_clock), &#160;&#160;&#160; statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160; read2(), &#160;&#160;&#160;&#160;&#160;&#160;&#160; {_, Time1} = statistics(wall_clock), &#160;&#160;&#160; {_, Time2} = statistics(runtime), &#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>一直知道mnesia的事务比较慢，但慢到什么程度却没有一个数值的概念，今天正好有空测试一下。</p>
<p>上代码：</p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">-module(mnesia_read_test)</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue;<br />
mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">-export([start/</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">0</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">, init_data/</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">0</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">, start2/</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">0</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">])</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue;<br />
mso-font-kerning:0pt">.</span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">-record(r_test, {id, name})</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue;<br />
mso-font-kerning:0pt">.</span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">start() -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>statistics(wall_clock), </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>statistics(runtime),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp; </span><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>read(),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">_</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">Time1</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">} = statistics(wall_clock),</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>{</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">_</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">, </span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">Time2</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">} = statistics(runtime),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>io:format(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:rosybrown;mso-font-kerning:<br />
0pt">&quot;times:~p, wall_clock ~p, runtime:~p&quot;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">, [</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:#5A5AB4;mso-font-kerning:0pt">100000</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:darkgoldenrod;mso-font-kerning:0pt">Time1</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:darkgoldenrod;mso-font-kerning:0pt">Time2</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">])</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:blue;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p>&nbsp;<span id="more-252"></span></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">start2() -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>statistics(wall_clock),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>statistics(runtime),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>read2(),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">_</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">Time1</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">} = statistics(wall_clock),</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>{</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">_</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">, </span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">Time2</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">} = statistics(runtime),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>io:format(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:rosybrown;mso-font-kerning:<br />
0pt">&quot;times:~p, wall_clock ~p, runtime:~p&quot;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">, [</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:#5A5AB4;mso-font-kerning:0pt">100000</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:darkgoldenrod;mso-font-kerning:0pt">Time1</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:darkgoldenrod;mso-font-kerning:0pt">Time2</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:<br />
0pt">])</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:blue;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p>&nbsp;</o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">read() -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>dirty_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;mso-font-kerning:<br />
0pt">100000</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:black;mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt">.</span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">dirty_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">0</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">) -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>ok;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">dirty_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">) -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:dirty_read(r_test, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>dirty_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">-</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">1</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue;<br />
mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p>&nbsp;</o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">read2() -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>t_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;mso-font-kerning:<br />
0pt">100000</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:black;mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p>&nbsp;</o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">t_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;mso-font-kerning:<br />
0pt">0</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:black;mso-font-kerning:0pt">) -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ok;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">t_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">) -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>mnesia:transaction( </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A020F0;<br />
mso-font-kerning:0pt">fun</span></b><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">() -&gt; mnesia:read(r_test, </span><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">) </span><b><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:#A020F0;mso-font-kerning:0pt">end</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">),</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>t_read(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">-</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">1</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue;<br />
mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p>&nbsp;</o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">init_data() -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:stop(),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:create_schema([node()]),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:start(),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:create_table(r_test, [</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{attributes, record_info(fields, r_test)},</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{record_name, r_test},</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{disc_copies, [node()]}</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>]),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:transaction(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A020F0;mso-font-kerning:<br />
0pt">fun</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:black;mso-font-kerning:0pt">() -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>t_write(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;mso-font-kerning:<br />
0pt">10000</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:black;mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#A020F0;mso-font-kerning:<br />
0pt">end</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>)</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt">.</span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">t_write(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#5A5AB4;<br />
mso-font-kerning:0pt">0</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">) -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>ok;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">t_write(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">) -&gt;</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">Name</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt"> = lists:append([</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:rosybrown;mso-font-kerning:<br />
0pt">&quot;name_&quot;</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">, </span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">]),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">R</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt"> = #r_test{id=</span><span lang="EN-US" style="font-size:<br />
10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">, name=</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">Name</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">},</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;mso-font-kerning:0pt"><o:p></o:p></span></span></font></p>
<p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:<br />
none;text-autospace:none"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>mnesia:write(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:darkgoldenrod;<br />
mso-font-kerning:0pt">R</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:black;mso-font-kerning:0pt">),</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:<br />
0pt"><o:p></o:p></span></span></font></p>
<p class="MsoNormal"><font class="Apple-style-span" color="#000000" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;<br />
color:black;mso-font-kerning:0pt"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>t_write(</span><span lang="EN-US" style="font-size:10.0pt;font-family:<br />
&quot;Courier New&quot;;color:darkgoldenrod;mso-font-kerning:0pt">N</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">-</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:#5A5AB4;mso-font-kerning:0pt">1</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:black;<br />
mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:10.0pt;<br />
font-family:&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt">.</span></span></font></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">两种情况都循环读了10W次，连续测试10次，机器配置为：</p>
<p class="MsoNormal">Intel(R) Xeon(R) CPU &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; E5420 &nbsp;@ 2.50GHz &nbsp; &nbsp; &nbsp;2*4核</p>
<p class="MsoNormal">12G内存</p>
<p class="MsoNormal">事务读测试结果：</p>
<p class="MsoNormal">times:100000, wall_clock 4168, runtime:4160ok</p>
<p class="MsoNormal">times:100000, wall_clock 4296, runtime:4250ok</p>
<p class="MsoNormal">times:100000, wall_clock 4338, runtime:4290ok</p>
<p class="MsoNormal">times:100000, wall_clock 4310, runtime:4260ok</p>
<p class="MsoNormal">times:100000, wall_clock 4330, runtime:4280ok</p>
<p class="MsoNormal">times:100000, wall_clock 4342, runtime:4270ok</p>
<p class="MsoNormal">times:100000, wall_clock 4399, runtime:4310ok</p>
<p class="MsoNormal">times:100000, wall_clock 4366, runtime:4310ok</p>
<p class="MsoNormal">times:100000, wall_clock 4378, runtime:4310ok</p>
<p class="MsoNormal">times:100000, wall_clock 4429, runtime:4330ok</p>
<p class="MsoNormal"><span style="color:#f00;">一次读的时间大于为44us，这还是在没有分布式的情况下的测试结果，如果是在分布式环境中，由于网络IO和远程加锁，性能会更差。</span></p>
<p class="MsoNormal">脏读测试结果：</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">times:100000, wall_clock 128, runtime:130ok</p>
<p class="MsoNormal">times:100000, wall_clock 126, runtime:120ok</p>
<p class="MsoNormal">times:100000, wall_clock 124, runtime:120ok</p>
<p class="MsoNormal">times:100000, wall_clock 126, runtime:120ok</p>
<p class="MsoNormal">times:100000, wall_clock 127, runtime:130ok</p>
<p class="MsoNormal">times:100000, wall_clock 125, runtime:130ok</p>
<p class="MsoNormal">times:100000, wall_clock 125, runtime:120ok</p>
<p class="MsoNormal">times:100000, wall_clock 127, runtime:120ok</p>
<p class="MsoNormal">times:100000, wall_clock 128, runtime:130ok</p>
<p class="MsoNormal">times:100000, wall_clock 127, runtime:130ok</p>
<p class="MsoNormal"><span style="color: rgb(255, 0, 0); ">和ets的性能几乎一样，一次读取的消耗大约1.2us，和事务相比快了几十倍。</span>追踪脏读源码到mnesia_lib.erl中：</p>
<p align="left" class="MsoNormal" style="text-align: left; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">db_get(</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">) -&gt;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; "><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>db_get(val({</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">, storage_type}),&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">)</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">.</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">db_get(ram_copies,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">) -&gt;&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(95, 158, 160); ">?ets_lookup</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">(</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">);</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">db_get(disc_copies,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">) -&gt;&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(95, 158, 160); ">?ets_lookup</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">(</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">);</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 24pt; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">db_get(disc_only_copies,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">) -&gt; dets:lookup(</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Tab</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">,&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(184, 134, 11); ">Key</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: black; ">)</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">.</span></p>
<p class="MsoNormal" style="text-indent: 24pt; ">呵呵，果然是ets直接操作。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/05/mnesia%e8%84%8f%e8%af%bb%e4%b8%8e%e4%ba%8b%e7%89%a9%e8%af%bb%e6%80%a7%e8%83%bd%e7%bb%93%e6%9e%9c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>装了Ubuntu 10.04</title>
		<link>http://www.qingliangcn.com/2010/05/%e8%a3%85%e4%ba%86ubuntu-10-04/</link>
		<comments>http://www.qingliangcn.com/2010/05/%e8%a3%85%e4%ba%86ubuntu-10-04/#comments</comments>
		<pubDate>Wed, 05 May 2010 17:11:57 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=250</guid>
		<description><![CDATA[这两天着实折腾了一把，先后安装了ubuntu的32位和64位版本，最后无赖还是选择了32位版本 &#8212; 软件支持的原因。 之前一直因为QQ的问题无法转过来，现在有了webqq和linuxqq，暂时可以尝试下了。]]></description>
			<content:encoded><![CDATA[<p>这两天着实折腾了一把，先后安装了ubuntu的32位和64位版本，最后无赖还是选择了32位版本 &#8212; 软件支持的原因。</p>
<p>之前一直因为QQ的问题无法转过来，现在有了webqq和linuxqq，暂时可以尝试下了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/05/%e8%a3%85%e4%ba%86ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gen_server三两话</title>
		<link>http://www.qingliangcn.com/2010/04/gen_server%e4%b8%89%e4%b8%a4%e8%af%9d/</link>
		<comments>http://www.qingliangcn.com/2010/04/gen_server%e4%b8%89%e4%b8%a4%e8%af%9d/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 02:53:49 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[gen_server]]></category>
		<category><![CDATA[otp]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=248</guid>
		<description><![CDATA[(最近挺忙，都没时间写点啥) gen_server是OTP中的一个重要组成，在开发中出现的频率相当高。弄明白这一块的，对于gen_server的使用有着相当好的帮忙。下面多数为代码。 从start_link开始： gen_server.erl start_link(Name,&#160;Mod,&#160;Args,&#160;Options)&#160;-&#62; gen:start(?MODULE,&#160;link,&#160;Name,&#160;Mod,&#160;Args,&#160;Options). &#160; 跳到gen.erl，这里的GenMod值为gen_server，LinkP为link start(GenMod,&#160;LinkP,&#160;Name,&#160;Mod,&#160;Args,&#160;Options)&#160;-&#62; &#160;&#160;&#160;&#160;case&#160;where(Name)&#160;of undefined&#160;-&#62; &#160;&#160;&#160;&#160;do_spawn(GenMod,&#160;LinkP,&#160;Name,&#160;Mod,&#160;Args,&#160;Options); Pid&#160;-&#62; &#160;&#160;&#160;&#160;{error,&#160;{already_started,&#160;Pid}} end. 再跳： do_spawn(GenMod,&#160;link,&#160;Name,&#160;Mod,&#160;Args,&#160;Options)&#160;-&#62; &#160;&#160;&#160;&#160;Time&#160;=&#160;timeout(Options), &#160;&#160;&#160;&#160;proc_lib:start_link(?MODULE,&#160;init_it, [GenMod,&#160;self(),&#160;self(),&#160;Name,&#160;Mod,&#160;Args,&#160;Options], Time, spawn_opts(Options)); 跳到proc_lib.erl文件： start_link(M,F,A,Timeout,SpawnOpts)&#160;when&#160;is_atom(M),&#160;is_atom(F),&#160;is_list(A)&#160;-&#62; &#160;&#160;&#160;&#160;Pid&#160;=&#160;?MODULE:spawn_opt(M,&#160;F,&#160;A,&#160;ensure_link(SpawnOpts)), sync_wait(Pid,&#160;Timeout). 注意这里有个等待返回，之后需要proc_lib:init_ack来返回消息。 spawn_opt(M,&#160;F,&#160;A,&#160;Opts)&#160;when&#160;is_atom(M),&#160;is_atom(F),&#160;is_list(A)&#160;-&#62; &#160;&#160;&#160;&#160;Parent&#160;=&#160;get_my_name(), &#160;&#160;&#160;&#160;Ancestors&#160;=&#160;get_ancestors(), &#160;&#160;&#160;&#160;check_for_monitor(Opts), &#160;&#160;&#160;&#160;erlang:spawn_opt(?MODULE,&#160;init_p,&#160;[Parent,Ancestors,M,F,A],&#160;Opts). 这里调用proc_lib模块的init_p方法： -spec&#160;init_p(pid(),&#160;[pid()],&#160;function())&#160;-&#62;&#160;term(). init_p(Parent,&#160;Ancestors,&#160;Fun)&#160;when&#160;is_function(Fun)&#160;-&#62; &#160;&#160;&#160;&#160;put(&#39;$ancestors&#39;,&#160;[Parent&#124;Ancestors]), &#160;&#160;&#160;&#160;{module,Mod}&#160;=&#160;erlang:fun_info(Fun,&#160;module), &#160;&#160;&#160;&#160;{name,Name}&#160;=&#160;erlang:fun_info(Fun,&#160;name), &#160;&#160;&#160;&#160;{arity,Arity}&#160;=&#160;erlang:fun_info(Fun,&#160;arity), &#160;&#160;&#160;&#160;put(&#39;$initial_call&#39;,&#160;{Mod,Name,Arity}), &#160;&#160;&#160;&#160;try Fun() &#160;&#160;&#160;&#160;catch Class:Reason&#160;-&#62; &#160;&#160;&#160;&#160;exit_p(Class,&#160;Reason) &#160;&#160;&#160;&#160;end. -spec&#160;init_p(pid(),&#160;[pid()],&#160;atom(),&#160;atom(),&#160;[term()])&#160;-&#62;&#160;term(). init_p(Parent,&#160;Ancestors,&#160;M,&#160;F,&#160;A)&#160;when&#160;is_atom(M),&#160;is_atom(F),&#160;is_list(A)&#160;-&#62; &#160;&#160;&#160;&#160;put(&#39;$ancestors&#39;,&#160;[Parent&#124;Ancestors]), &#160;&#160;&#160;&#160;put(&#39;$initial_call&#39;,&#160;trans_init(M,&#160;F,&#160;A)), &#160;&#160;&#160;&#160;init_p_do_apply(M,&#160;F,&#160;A). init_p_do_apply(M,&#160;F,&#160;A)&#160;-&#62; &#160;&#160;&#160;&#160;try apply(M,&#160;F,&#160;A)&#160; &#160;&#160;&#160;&#160;catch [...]]]></description>
			<content:encoded><![CDATA[<div class="Section0" style="layout-grid:  15.6pt none">
<p><span style="font-family: '宋体'; font-size: 16pt; font-weight: bold; mso-spacerun: 'yes'"><o:p><span style="font-size: 11px"><span style="font-size: 12px">(最近挺忙，都没时间写点啥)</span></span></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">gen_server<font face="宋体">是</font><font face="Courier New">OTP</font><font face="宋体">中的一个重要组成，在开发中出现的频率相当高。弄明白这一块的，对于</font><font face="Courier New">gen_server</font><font face="宋体">的使用有着相当好的帮忙。下面多数为代码。</font></span><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">从<font face="Courier New">start_link</font><font face="宋体">开始：</font></span><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">gen_server.erl</span><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">start_link(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">gen:start(</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;link,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt">&nbsp;</p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><span id="more-248"></span></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">跳到<font face="Times New Roman">gen.erl</font><font face="宋体">，这里的</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">值为</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">gen_server<font face="宋体">，</font><font face="Times New Roman">LinkP</font><font face="宋体">为</font><font face="Times New Roman">link</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">start(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">LinkP</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;where(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">undefined&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;do_spawn(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">LinkP</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Pid</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;{error,&nbsp;{already_started,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Pid</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}}</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">再跳：</span><span style="font-family: '宋体'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">do_spawn(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;link,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;timeout(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:start_link(</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;init_it,</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">[</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;self(),&nbsp;self(),&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">],</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">spawn_opts(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">));</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">跳到<font face="Courier New">proc_lib.erl</font><font face="宋体">文件：</font></span><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">start_link(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Timeout</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">SpawnOpts</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">when</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;is_atom(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),&nbsp;is_atom(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),&nbsp;is_list(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Pid</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:spawn_opt(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;ensure_link(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">SpawnOpts</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">sync_wait(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Pid</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Timeout</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">注意这里有个等待返回，之后需要</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">proc_lib:init_ack</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">来返回消息。</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">spawn_opt(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Opts</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">when</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;is_atom(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),&nbsp;is_atom(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),&nbsp;is_list(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;get_my_name(),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Ancestors</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;get_ancestors(),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;check_for_monitor(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Opts</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;erlang:spawn_opt(</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;init_p,&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Ancestors</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">],&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Opts</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">这里调用</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">proc_lib<font face="宋体">模块的</font><font face="Times New Roman">init_p</font><font face="宋体">方法：</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">-</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">spec</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;init_p(pid(),&nbsp;[pid()],&nbsp;function())&nbsp;-&gt;&nbsp;term()</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_p(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Ancestors</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">when</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;is_function(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;put(&#39;$ancestors&#39;,&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">|</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Ancestors</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">]),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;{module,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:fun_info(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;module),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;{name,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:fun_info(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;name),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;{arity,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Arity</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:fun_info(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;arity),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;put(&#39;$initial_call&#39;,&nbsp;{</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Arity</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">try</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">()</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">catch</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Class</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit_p(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Class</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">-</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">spec</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;init_p(pid(),&nbsp;[pid()],&nbsp;atom(),&nbsp;atom(),&nbsp;[term()])&nbsp;-&gt;&nbsp;term()</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_p(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Ancestors</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">when</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;is_atom(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),&nbsp;is_atom(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),&nbsp;is_list(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;put(&#39;$ancestors&#39;,&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">|</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Ancestors</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">]),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;put(&#39;$initial_call&#39;,&nbsp;trans_init(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;init_p_do_apply(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_p_do_apply(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">try</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">apply(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">M</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">F</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">A</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">catch</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Class</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit_p(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Class</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">有点晕头了吧，<font face="Times New Roman">MFA</font><font face="宋体">是什么呢？如下：</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">gen</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;init_it,</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">[</span><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">gen_server</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;self(),&nbsp;self(),&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">]</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">这里的</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">是我们自己的注册名，模块名、参数。</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">调回<font face="Times New Roman">init</font><font face="宋体">：</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_it(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;name_register(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">true&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;init_it2(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{false,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Pid</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{error,&nbsp;{already_started,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Pid</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}})</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_it2(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">GenMod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:init_it(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">ok<font face="宋体">，又回到</font><font face="Times New Roman">gen_server</font><font face="宋体">了。跳转到</font><font face="Times New Roman">gen_server</font><font face="宋体">的</font><font face="Times New Roman">init_it</font><font face="宋体">：</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_it(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;self,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;init_it(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;self(),&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">init_it(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name0</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;name(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name0</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;debug_options(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Options</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">catch</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:init(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Args</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{ok,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{ok,&nbsp;self()}),&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"> </span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;loop(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;infinity,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{ok,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Timeout</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{ok,&nbsp;self()}),&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"> </span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;loop(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Timeout</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{stop,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(178,34,34); font-size: 10.5pt; mso-spacerun: 'yes'">%%&nbsp;For&nbsp;consistency,&nbsp;we&nbsp;must&nbsp;make&nbsp;sure&nbsp;that&nbsp;the</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(178,34,34); font-size: 10.5pt; mso-spacerun: 'yes'">%%&nbsp;registered&nbsp;name&nbsp;(if&nbsp;any)&nbsp;is&nbsp;unregistered&nbsp;before</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(178,34,34); font-size: 10.5pt; mso-spacerun: 'yes'">%%&nbsp;the&nbsp;parent&nbsp;process&nbsp;is&nbsp;notified&nbsp;about&nbsp;the&nbsp;failure.</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(178,34,34); font-size: 10.5pt; mso-spacerun: 'yes'">%%&nbsp;(Otherwise,&nbsp;the&nbsp;parent&nbsp;process&nbsp;could&nbsp;get</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(178,34,34); font-size: 10.5pt; mso-spacerun: 'yes'">%%&nbsp;an&nbsp;&#39;already_started&#39;&nbsp;error&nbsp;if&nbsp;it&nbsp;immediately</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(178,34,34); font-size: 10.5pt; mso-spacerun: 'yes'">%%&nbsp;tried&nbsp;starting&nbsp;the&nbsp;process&nbsp;again.)</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;unregister_name(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name0</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{error,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">ignore&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;unregister_name(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name0</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;ignore),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(normal);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{&#39;EXIT&#39;,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;unregister_name(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name0</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{error,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Else</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Error</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;{bad_return_value,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Else</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">},</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:init_ack(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Starter</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{error,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Error</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Error</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">呵呵，苦尽甘来，终于来到<font face="Courier New">loop</font><font face="宋体">主循环了。&nbsp;</font><font face="Courier New">gen_server</font><font face="宋体">的消息怎么来的？就是这个</font><font face="Courier New">loop</font><font face="宋体">不断地取出消息、</font><font face="Courier New">decode_msg</font><font face="宋体">、再</font><font face="Courier New">loop</font><font face="宋体">来不断从消息队列中取出消息的。这个主循环就是我们的</font><font face="Courier New">gen_server</font><font face="宋体">进程了。</font></span><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">loop(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;hibernate,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;proc_lib:hibernate(</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,wake_hib,[</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">]);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">loop(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">receive</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Input</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Input</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">after</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;timeout</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;decode_msg(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;false)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">decode_msg(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Hib</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{system,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">From</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Req</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;sys:handle_system_msg(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Req</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">From</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Time</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">],&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Hib</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{&#39;EXIT&#39;,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;terminate(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">_Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">when</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=:=&nbsp;[]&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;handle_msg(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">_Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;=&nbsp;sys:handle_debug(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{</span><span style="font-family: 'courier new'; color: rgb(95,158,160); font-size: 10.5pt; mso-spacerun: 'yes'">?MODULE</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;print_event},&nbsp;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;{in,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;handle_msg(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">这里我们就看到了</span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">terminate<font face="宋体">的自动回调（如果设置了</font><font face="Times New Roman">trap_exit</font><font face="宋体">）。</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">handle_msg<font face="宋体">中处理了</font><font face="Times New Roman">handle_call</font><font face="宋体">类型的调用，&nbsp;而</font><font face="Times New Roman">handle_cast</font><font face="宋体">和</font><font face="Times New Roman">handle_info</font><font face="宋体">则由</font></span><span style="font-family: 'courier new'; background: rgb(255,255,255); color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'; mso-highlight: rgb(255, 255, 255)">dispatch</span><span style="font-family: '宋体'; background: rgb(255,255,255); color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'; mso-highlight: rgb(255, 255, 255)">来处理：</span><span style="font-family: '宋体'; background: rgb(255,255,255); color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'; mso-highlight: rgb(255, 255, 255)"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">dispatch({&#39;$gen_cast&#39;,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">},&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:handle_cast(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">dispatch(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Info</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:handle_info(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Info</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">handle_msg<font face="宋体">处理</font><font face="Times New Roman">handle_call</font><font face="宋体">也很简单，回调我们的</font><font face="Times New Roman">handle_call</font><font face="宋体">方法：</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">handle_msg({&#39;$gen_call&#39;,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">From</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">},&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Parent</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">catch</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:handle_call(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">From</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">&#8230;&#8230;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">至此，整个<font face="Times New Roman">gen_server</font><font face="宋体">的运行流程就清楚了（晕的话，多看几遍）。</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">回头再来看看<font face="Times New Roman">terminate</font><font face="宋体">的处理</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">terminate(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">catch</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Mod</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">:terminate(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{&#39;EXIT&#39;,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">R</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;error_info(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">R</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">R</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">case</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">of</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">normal&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(normal);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">shutdown&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(shutdown);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">{shutdown,</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">}=</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Shutdown</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Shutdown</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">);</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;error_info(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Name</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Msg</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">State</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Debug</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">),</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="font-family: 'courier new'; color: rgb(184,134,11); font-size: 10.5pt; mso-spacerun: 'yes'">Reason</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">)</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10.5pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10.5pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'">这里<font face="Times New Roman">terminate</font><font face="宋体">在回调了</font><font face="Times New Roman">gen_server</font><font face="宋体">的</font><font face="Times New Roman">terminate</font><font face="宋体">函数后，又</font><font face="Times New Roman">exit</font><font face="宋体">了一次，目的是为了产生一个</font><font face="Times New Roman">&#39;EXIT&#39;</font><font face="宋体">消息给</font><font face="Times New Roman">supervisor</font><font face="宋体">，以便让</font><font face="Times New Roman">supervisor</font><font face="宋体">做相应的重启策略。</font></span><span style="font-family: '宋体'; font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
</div>
<p><!--EndFragment--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/04/gen_server%e4%b8%89%e4%b8%a4%e8%af%9d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我心目中的英雄</title>
		<link>http://www.qingliangcn.com/2010/03/%e6%88%91%e5%bf%83%e7%9b%ae%e4%b8%ad%e7%9a%84%e8%8b%b1%e9%9b%84/</link>
		<comments>http://www.qingliangcn.com/2010/03/%e6%88%91%e5%bf%83%e7%9b%ae%e4%b8%ad%e7%9a%84%e8%8b%b1%e9%9b%84/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 08:31:20 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/2010/03/%e6%88%91%e5%bf%83%e7%9b%ae%e4%b8%ad%e7%9a%84%e8%8b%b1%e9%9b%84/</guid>
		<description><![CDATA[我是个凡人，但这并不影响我对英雄的仰慕、敬佩。王克勤，一个普通得名字，做的却是不普通的事！http://wangkeqin.blog.sohu.com/]]></description>
			<content:encoded><![CDATA[<p>我是个凡人，但这并不影响我对英雄的仰慕、敬佩。王克勤，一个普通得名字，做的却是不普通的事！<a href="http://wangkeqin.blog.sohu.com/">http://wangkeqin.blog.sohu.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/03/%e6%88%91%e5%bf%83%e7%9b%ae%e4%b8%ad%e7%9a%84%e8%8b%b1%e9%9b%84/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erlang中日志管理三两话</title>
		<link>http://www.qingliangcn.com/2010/03/erlang%e4%b8%ad%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86%e4%b8%89%e4%b8%a4%e8%af%9d/</link>
		<comments>http://www.qingliangcn.com/2010/03/erlang%e4%b8%ad%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86%e4%b8%89%e4%b8%a4%e8%af%9d/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 08:05:42 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[动态日志]]></category>
		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=242</guid>
		<description><![CDATA[日志系统的重要性就不罗嗦了，直接开始吧。 &#160; 一、基本概念 &#160; 在Erlang中，通过两个概念管理错误事情：事件管理器(event manager)和事件处理句柄(event handles)。通常各种错误、警告和消息事件都会有Erlang运行时系统发送给事件管理器。在Erlang中，默认的事情管理器为error logger，其进程名注册为error_logger。默认情况下error_logger把这些事件直接输出到控制台上。 &#160; &#160;&#160;&#160;&#160;&#160;&#160; 在系统启动的一开始，error_logger只有一个简单的事件处理句柄，该处理句柄只是做缓冲和原始格式的打印操作。查看error_logger的源码，可以看到其启动过程如下： &#160; -spec start() -&#62; {&#39;ok&#39;, pid()} &#124; {&#39;error&#39;, any()}. &#160; start() -&#62; &#160;&#160;&#160; case gen_event:start({local, error_logger}) of &#160;&#160;&#160; {ok, Pid} -&#62; &#160;&#160;&#160; &#160;&#160;&#160; simple_logger(?buffer_size), &#160;&#160;&#160; &#160;&#160;&#160; {ok, Pid}; &#160;&#160;&#160; Error -&#62; Error &#160;&#160;&#160; end. &#160; -spec start_link() -&#62; {&#39;ok&#39;, pid()} &#124; {&#39;error&#39;, any()}. &#160; [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'"><font color="#000000" size="3">日志系统的重要性就不罗嗦了，直接开始吧。</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: -21pt; margin: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-bidi-font-family: 宋体"><span style="mso-list: ignore"><font face="Times New Roman">一、</font></span></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">基本概念</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">在</span><span lang="EN-US"><font face="Times New Roman">Erlang</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">中，通过两个概念管理错误事情：事件管理器</span><span lang="EN-US"><font face="Times New Roman">(event manager)</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">和事件处理句柄</span><span lang="EN-US"><font face="Times New Roman">(event handles)</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">。通常各种错误、警告和消息事件都会有</span><span lang="EN-US"><font face="Times New Roman">Erlang</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">运行时系统发送给事件管理器。在</span><span lang="EN-US"><font face="Times New Roman">Erlang</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">中，默认的事情管理器为</span><span lang="EN-US"><font face="Times New Roman">error logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，其进程名注册为</span><span lang="EN-US"><font face="Times New Roman">error_logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">。默认情况下</span><span lang="EN-US"><font face="Times New Roman">error_logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">把这些事件直接输出到控制台上。<span id="more-242"></span></span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">在系统启动的一开始，</span><span lang="EN-US"><font face="Times New Roman">error_logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">只有一个简单的事件处理句柄，该处理句柄只是做缓冲和原始格式的打印操作。查看</span><span lang="EN-US"><font face="Times New Roman">error_logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">的源码，可以看到其启动过程如下：</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">-</span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">spec</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> start() -&gt; {&#39;ok&#39;, pid()} | {&#39;error&#39;, any()}</span><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p><font color="#000000">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">start() -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">case</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> gen_event:start({local, error_logger}) </span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">of</span></b><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Pid</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">} -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>simple_logger(?buffer_size),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Pid</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">};</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Error</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> -&gt; </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Error</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">end</span></b><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p><font color="#000000">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">-</span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">spec</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> start_link() -&gt; {&#39;ok&#39;, pid()} | {&#39;error&#39;, any()}</span><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p><font color="#000000">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">start_link() -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">case</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> gen_event:start_link({local, error_logger}) </span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">of</span></b><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Pid</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">} -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>simple_logger(?buffer_size),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Pid</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">};</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Error</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> -&gt; </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Error</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">end</span></b><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font color="#000000"><font size="3"><span lang="EN-US"><font face="Times New Roman">OK</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，只是简单的注册了一个进程，看看</span></font><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">simple_logger</span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'"><font size="3">的内容：</font></span></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">simple_logger(</span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Buffer_size</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">) </span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">when</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> is_integer(</span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Buffer_size</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">) -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">gen_event:add_handler(error_logger, error_logger, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Buffer_size</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">)</span><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">看来</span><span lang="EN-US"><font face="Times New Roman">error_logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">在一开始的时候除了充当</span><span lang="EN-US"><font face="Times New Roman">manager</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，也担当了</span><span lang="EN-US"><font face="Times New Roman">handler</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">的角色。</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">在启动的过程中，</span><span lang="EN-US"><font face="Times New Roman">kernel application</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">使用一个标准的事件处理句柄来代替之前的那个简单版本，这个版本会将输出到控制台的结果做个漂亮的格式化。当然，可以通过</span><span lang="EN-US"><font face="Times New Roman">kernel</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">的配置选项来修改上述行为，例如将结果输出到文件或者干脆什么都不干（忽略任何</span><span lang="EN-US"><font face="Times New Roman">event</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">）。口说无凭，还是继续看源码吧：</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">kernel.erl</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">文件：</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">start(</span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">_</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">, []) -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">case</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> supervisor:start_link({local, kernel_sup}, kernel, []) </span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">of</span></b><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Pid</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">} -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Type</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> = get_error_logger_type(),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>error_logger:swap_handler(</span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Type</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Pid</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">, []};</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span></span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Error</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> -&gt; </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Error</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">end</span></b><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font color="#000000"><font size="3"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">首先，</span><span lang="EN-US"><font face="Times New Roman">kernel</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">把自己注册为一个名为</span></font><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">kernel_sup</span></font><span style="font-family: 宋体; color: black; font-size: 10pt; mso-ascii-font-family: 'courier new'; mso-hansi-font-family: 'courier new'; mso-font-kerning: 0pt; mso-bidi-font-family: 'courier new'">的监控树进程，其次立刻就更换了</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">error_logger</span><span style="font-family: 宋体; color: black; font-size: 10pt; mso-ascii-font-family: 'courier new'; mso-hansi-font-family: 'courier new'; mso-font-kerning: 0pt; mso-bidi-font-family: 'courier new'">的处理句柄。</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">go on</span><span style="font-family: 宋体; color: black; font-size: 10pt; mso-ascii-font-family: 'courier new'; mso-hansi-font-family: 'courier new'; mso-font-kerning: 0pt; mso-bidi-font-family: 'courier new'">：</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">get_error_logger_type() -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">case</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> application:get_env(kernel, error_logger) </span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">of</span></b><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, tty} -&gt; tty;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, {file, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">File</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">}} </span><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">when</span></b><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> is_list(</span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">File</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">) -&gt; {logfile, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">File</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">};</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, false} -&gt; false;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, silent} -&gt; silent;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>undefined -&gt; tty; </span><span lang="EN-US" style="font-family: 'courier new'; color: firebrick; font-size: 10pt; mso-font-kerning: 0pt">% default value</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{ok, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Bad</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">} -&gt; exit({bad_config, {kernel, {error_logger, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">Bad</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">}}})</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><b><span lang="EN-US" style="font-family: 'courier new'; color: #a020f0; font-size: 10pt; mso-font-kerning: 0pt">end</span></b><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'"><font color="#000000" size="3">代码很容易理解，根据配置来决定以何种方式处理日志。</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: -21pt; margin: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-bidi-font-family: 宋体"><span style="mso-list: ignore"><font face="Times New Roman">二、</font></span></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">定制</span><span lang="EN-US"><font face="Times New Roman">Kernel</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">选项</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'"><font color="#000000" size="3">继续接着上面的代码往下走：</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">swap_handler(tty) -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>gen_event:swap_handler(error_logger, {error_logger, swap},</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp; </span>{error_logger_tty_h, []}),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>simple_logger();</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">swap_handler({logfile, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">File</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">}) -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>gen_event:swap_handler(error_logger, {error_logger, swap},</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp; </span>{error_logger_file_h, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">File</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">}),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>simple_logger();</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">swap_handler(silent) -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>gen_event:delete_handler(error_logger, error_logger, delete),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>simple_logger();</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">swap_handler(false) -&gt;</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">ok</span><span lang="EN-US" style="font-family: 'courier new'; color: blue; font-size: 10pt; mso-font-kerning: 0pt">.</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"> </span><span lang="EN-US" style="font-family: 'courier new'; color: firebrick; font-size: 10pt; mso-font-kerning: 0pt">% keep primitive event handler as-is<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: firebrick; font-size: 10pt; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">可以看出，如果我们真的希望什么都不做，那么应该传递参数</span><span lang="EN-US"><font face="Times New Roman"> silent</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，而不是</span><span lang="EN-US"><font face="Times New Roman">false</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，因为</span><span lang="EN-US"><font face="Times New Roman">false</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">情况下原来的原始处理句柄并没有被移除掉。</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">打开命令提示符，做个简单的实验</span><span lang="EN-US"><font face="Times New Roman">(&gt;</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">表示命令提示符</span><span lang="EN-US"><font face="Times New Roman">)</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">：</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><b style="mso-bidi-font-weight: normal"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">实验一，定制为</span><span lang="EN-US"><font face="Times New Roman">false</font></span></b><b style="mso-bidi-font-weight: normal"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">参数：</span><span lang="EN-US"><o:p></o:p></span></b></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">&gt; erl -kernel error_logger false<span style="mso-spacerun: yes">&nbsp; </span>//</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">传递</span><span lang="EN-US"><font face="Times New Roman">false</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">参数</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">2&gt; error_logger:error_msg(&quot;Haha&quot;). <span style="mso-spacerun: yes">&nbsp;</span>// </font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">尝试产生一个</span><span lang="EN-US"><font face="Times New Roman">error event</font></span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font color="#000000" face="Times New Roman" size="3">ok{error_logger,{{</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">2010,2&gt; 3,10},{15,9,1}},&quot;Haha&quot;,[]}<span style="mso-spacerun: yes">&nbsp; </span>//</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">这里是结果</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><b style="mso-bidi-font-weight: normal"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">实验二，定制为</span><span lang="EN-US"><font face="Times New Roman">silent</font></span></b><b style="mso-bidi-font-weight: normal"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">参数：</span><span lang="EN-US"><o:p></o:p></span></b></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">&gt; erl -kernel error_logger silent<span style="mso-spacerun: yes">&nbsp; </span>//</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">传递</span><span lang="EN-US"><font face="Times New Roman">silent </font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">参数</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font color="#000000" face="Times New Roman" size="3">1&gt;<span style="mso-spacerun: yes">&nbsp; </span>error_logger:error_msg(&quot;Haha&quot;).</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">ok<span style="mso-spacerun: yes">&nbsp;&nbsp; </span>// </font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">看到这里只有</span><span lang="EN-US"><font face="Times New Roman">ok</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，没有其他任何信息了！</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font color="#000000" face="Times New Roman" size="3">2&gt;</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: -21pt; margin: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1"><font face="Times New Roman"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-bidi-font-family: 宋体"><span style="mso-list: ignore">三、</span></span><span lang="EN-US">SASL</span></font></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">SASL</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">全称</span><span lang="EN-US"><font face="Times New Roman">System Architecture Support Libraries</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">，提供如下几个服务：</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-font-kerning: 0pt"><font face="Times New Roman">alarm_handler</font></span><span lang="EN-US" style="font-family: 'verdana', 'sans-serif'; mso-font-kerning: 0pt"> <o:p></o:p></span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-font-kerning: 0pt"><font face="Times New Roman">overload</font></span><span lang="EN-US" style="font-family: 'verdana', 'sans-serif'; mso-font-kerning: 0pt"> <o:p></o:p></span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-font-kerning: 0pt"><font face="Times New Roman">rb</font></span><span lang="EN-US" style="font-family: 'verdana', 'sans-serif'; mso-font-kerning: 0pt"> <o:p></o:p></span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-font-kerning: 0pt"><font face="Times New Roman">release_handler</font></span><span lang="EN-US" style="font-family: 'verdana', 'sans-serif'; mso-font-kerning: 0pt"> <o:p></o:p></span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font face="Times New Roman"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-font-kerning: 0pt">systools</span><span lang="EN-US" style="font-family: 'verdana', 'sans-serif'; mso-font-kerning: 0pt"><o:p></o:p></span></font></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">SASL</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">带有</span><span lang="EN-US"><font face="Times New Roman">error_logger</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">的事件处理句柄用于格式化</span><span lang="EN-US"><font face="Times New Roman">SASL</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">错误和</span><span lang="EN-US"><font face="Times New Roman">crash</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">报告，这些句柄如下：</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span class="code"><span lang="EN-US"><font face="Courier"><font size="3"><font color="#000000">sasl_report_tty_h<span style="mso-spacerun: yes">&nbsp;&nbsp; </span>sasl_report_file_h<span style="mso-spacerun: yes">&nbsp;&nbsp; </span>error_logger_mf_h<o:p></o:p></font></font></font></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">细节参考</span><span lang="EN-US"><font face="Courier">OTP</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">文档可知。</span><span lang="EN-US"><o:p></o:p></span></span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span class="code"><span lang="EN-US"><font face="Courier">SASL</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">的默认</span><span lang="EN-US"><font face="Courier">event handler</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">会将</span><span lang="EN-US"><font face="Courier">crash</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">报告、</span><span lang="EN-US"><font face="Courier">supervisor</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">和进程报告输出到控制台，如果你希望看到这些信息，那么在</span><span lang="EN-US"><font face="Courier">erlang</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">启动时需要加上指定的参数以启动</span><span lang="EN-US"><font face="Courier">sasl</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">。</span><span lang="EN-US"><o:p></o:p></span></span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">为了方便日志的查看，通常</span><span lang="EN-US"><font face="Courier">sasl</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">和其他日志是分开输出的，可以在启动</span><span lang="EN-US"><font face="Courier">erl</font></span></span><span class="code"><span style="font-family: 宋体; mso-ascii-font-family: courier; mso-hansi-font-family: courier">时使用如下命令行参数：</span><span lang="EN-US"><o:p></o:p></span></span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US"><font color="#000000" face="Times New Roman" size="3">-sasl sasl_error_logger {file,&quot;/data/ log/sasl.log&quot;}</font></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: -21pt; margin: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1"><font size="3"><font color="#000000"><span lang="EN-US" style="mso-bidi-font-family: 宋体"><span style="mso-list: ignore"><font face="Times New Roman">四、</font></span></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">站在巨人的肩膀上</span></font></font></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">这里并不打算介绍一个</span><span lang="EN-US"><font face="Times New Roman">gen_event behavior</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">模块的写法，而是想介绍一个非常强大、成熟的一个日志系统：</span><span lang="EN-US"><font face="Times New Roman">ejabberd</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">的日志系统。它包含两个部分：</span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">dynamic_compile.erl<span style="mso-spacerun: yes">&nbsp;&nbsp; </span></font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">动态编译基础模块</span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">ejabberd_logger_h.erl<span style="mso-spacerun: yes">&nbsp; </span></font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">这是个</span><span lang="EN-US"><font face="Times New Roman">gen_event behavior</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">模块，可以定制我们写日志的行为</span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span lang="EN-US"><font face="Times New Roman">ejabberd_loglevel.h<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">这个是</span><span lang="EN-US"><font face="Times New Roman">ejabberd</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">日志系统的精华，可以在运行时动态调节日志的输出级别。</span></font></font></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font color="#000000" face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="text-indent: 21pt; margin: 0cm 0cm 0pt"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'"><font color="#000000" size="3">用法很简单：</font></span></p>
<p align="left" class="MsoNormal" style="text-align: left; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">error_logger:add_report_handler(ejabberd_logger_h, </span><span lang="EN-US" style="font-family: 'courier new'; color: darkgoldenrod; font-size: 10pt; mso-font-kerning: 0pt">LogPath</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">),</span><span lang="EN-US" style="font-family: 'courier new'; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">ejabberd_loglevel:set(</span><span lang="EN-US" style="font-family: 'courier new'; color: #5a5ab4; font-size: 10pt; mso-font-kerning: 0pt">4</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">)<span style="mso-tab-count: 1"> </span>//</span><span style="font-family: 宋体; color: black; font-size: 10pt; mso-ascii-font-family: 'courier new'; mso-hansi-font-family: 'courier new'; mso-font-kerning: 0pt; mso-bidi-font-family: 'courier new'">级别</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">4</span><span style="font-family: 宋体; color: black; font-size: 10pt; mso-ascii-font-family: 'courier new'; mso-hansi-font-family: 'courier new'; mso-font-kerning: 0pt; mso-bidi-font-family: 'courier new'">是</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt">info</span><span style="font-family: 宋体; color: black; font-size: 10pt; mso-ascii-font-family: 'courier new'; mso-hansi-font-family: 'courier new'; mso-font-kerning: 0pt; mso-bidi-font-family: 'courier new'">日志</span><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'courier new'; color: black; font-size: 10pt; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><font size="3"><font color="#000000"><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'; mso-font-kerning: 0pt">原理很简单，利用</span><span lang="EN-US" style="mso-font-kerning: 0pt"><font face="Times New Roman">code</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'; mso-font-kerning: 0pt">模块的</span><span lang="EN-US" style="mso-font-kerning: 0pt"><font face="Times New Roman">load_binary</font></span><span style="font-family: 宋体; mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'; mso-font-kerning: 0pt">来实现动态代码替换，但是确实非常强大，可以在需要的时候打开某些特定级别的日志，在系统负载高的时候或者不需要的时候关闭它。</span></font></font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/03/erlang%e4%b8%ad%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86%e4%b8%89%e4%b8%a4%e8%af%9d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QQ群：PHP内核与扩展研究 48448818</title>
		<link>http://www.qingliangcn.com/2010/03/qq%e7%be%a4%ef%bc%9aphp%e5%86%85%e6%a0%b8%e4%b8%8e%e6%89%a9%e5%b1%95%e7%a0%94%e7%a9%b6-48448818/</link>
		<comments>http://www.qingliangcn.com/2010/03/qq%e7%be%a4%ef%bc%9aphp%e5%86%85%e6%a0%b8%e4%b8%8e%e6%89%a9%e5%b1%95%e7%a0%94%e7%a9%b6-48448818/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:45:36 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/2010/03/qq%e7%be%a4%ef%bc%9aphp%e5%86%85%e6%a0%b8%e4%b8%8e%e6%89%a9%e5%b1%95%e7%a0%94%e7%a9%b6-48448818/</guid>
		<description><![CDATA[QQ群：PHP内核与扩展研究 48448818 PHP内核与扩展研究。加群请说明自己感兴趣领域或者擅长领域！否则一律不予通过，请谅]]></description>
			<content:encoded><![CDATA[<p>QQ群：PHP内核与扩展研究 48448818<br />
PHP内核与扩展研究。加群请说明自己感兴趣领域或者擅长领域！否则一律不予通过，请谅</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/03/qq%e7%be%a4%ef%bc%9aphp%e5%86%85%e6%a0%b8%e4%b8%8e%e6%89%a9%e5%b1%95%e7%a0%94%e7%a9%b6-48448818/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>list comprehensions与list map性能对比</title>
		<link>http://www.qingliangcn.com/2010/02/list-comprehensions%e4%b8%8elist-map%e6%80%a7%e8%83%bd%e5%af%b9%e6%af%94/</link>
		<comments>http://www.qingliangcn.com/2010/02/list-comprehensions%e4%b8%8elist-map%e6%80%a7%e8%83%bd%e5%af%b9%e6%af%94/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 02:50:50 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>

		<guid isPermaLink="false">http://www.qingliangcn.com/?p=237</guid>
		<description><![CDATA[可以使用List&#160;comprehensions时不要&#160;使用map或者filter，简单的性能测试对比一下： 第一组，map和list&#160;comprehensions对比，代码如下： %%map方式 -module(map_test). -export([start/1]). start(N)&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;erlang:statistics(wall_clock), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;lists:map(fun&#160;(X)&#160;-&#62;&#160;X*X&#160;end,&#160;lists:seq(1,&#160;N)), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{_,&#160;T1}&#160;=&#160;erlang:statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{_,&#160;T2}&#160;=&#160;erlang:statistics(wall_clock), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;io:format(&#34;total&#160;times:&#160;~p,&#160;load&#160;time:&#160;~p&#160;(~p)&#34;,&#160;[N,&#160;T1,&#160;T2]). %%list&#160;comprehensions方式 -module(list_comp_test). -export([start/1]). start(N)&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;erlang:statistics(wall_clock), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;[X*X&#160;&#124;&#124;&#160;X&#160;&#60;-&#160;lists:seq(1,&#160;N)], &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{_,&#160;T1}&#160;=&#160;erlang:statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{_,&#160;T2}&#160;=&#160;erlang:statistics(wall_clock), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;io:format(&#34;total&#160;times:&#160;~p,&#160;load&#160;time:&#160;~p&#160;(~p)&#34;,&#160;[N,&#160;T1,&#160;T2]). 测试N为1000000时结果对比： 结果取得是平均值，可以很明显的看出comprehension方式性能要高。 关于filter，则类似。不再作测试。]]></description>
			<content:encoded><![CDATA[<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'">可以使用</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'">List&nbsp;comprehensions</span><span style="font-family: '新宋体'; font-size: 10pt; mso-spacerun: 'yes'">时不要</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'">使用<font face="Courier New">map</font><font face="新宋体">或者</font><font face="Courier New">filter</font><font face="新宋体">，简单的性能测试对比一下：</font></span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'">第一组，<font face="Courier New">map</font><font face="新宋体">和</font><font face="Courier New">list&nbsp;comprehensions</font><font face="新宋体">对比，代码如下：</font></span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">%%map<font face="新宋体">方式</font></span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">-module(map_test)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">-export([start/</span><span style="font-family: 'courier new'; color: rgb(90,90,180); font-size: 10pt; mso-spacerun: 'yes'">1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">])</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">start(</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">N</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;statistics(runtime),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erlang:statistics(wall_clock),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lists:map(</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">fun</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;(</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">X</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">)&nbsp;-&gt;&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">X</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">*</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">X</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;</span><span style="font-family: 'courier new'; color: rgb(160,32,240); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">end</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;lists:seq(</span><span style="font-family: 'courier new'; color: rgb(90,90,180); font-size: 10pt; mso-spacerun: 'yes'">1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">N</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">)),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:statistics(runtime),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T2</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:statistics(wall_clock),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io:format(</span><span style="font-family: 'courier new'; color: rgb(188,143,143); font-size: 10pt; mso-spacerun: 'yes'">&quot;total&nbsp;times:&nbsp;~p,&nbsp;load&nbsp;time:&nbsp;~p&nbsp;(~p)&quot;</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">N</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T2</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">])</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">%%list&nbsp;comprehensions<font face="宋体">方式</font></span><span style="font-family: '宋体'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">-module(list_comp_test)</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">-export([start/</span><span style="font-family: 'courier new'; color: rgb(90,90,180); font-size: 10pt; mso-spacerun: 'yes'">1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">])</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">start(</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">N</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">)&nbsp;-&gt;</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;statistics(runtime),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erlang:statistics(wall_clock),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">X</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">*</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">X</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;||&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">X</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&lt;-&nbsp;lists:seq(</span><span style="font-family: 'courier new'; color: rgb(90,90,180); font-size: 10pt; mso-spacerun: 'yes'">1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">N</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">)],</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:statistics(runtime),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">_</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T2</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">}&nbsp;=&nbsp;erlang:statistics(wall_clock),</span><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io:format(</span><span style="font-family: 'courier new'; color: rgb(188,143,143); font-size: 10pt; mso-spacerun: 'yes'">&quot;total&nbsp;times:&nbsp;~p,&nbsp;load&nbsp;time:&nbsp;~p&nbsp;(~p)&quot;</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;[</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">N</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T1</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-family: 'courier new'; color: rgb(0,128,0); font-size: 10pt; font-weight: bold; mso-spacerun: 'yes'">T2</span><span style="font-family: 'courier new'; color: rgb(0,0,0); font-size: 10pt; mso-spacerun: 'yes'">])</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'">.</span><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'courier new'; color: rgb(0,0,255); font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10pt; mso-spacerun: 'yes'">测试<font face="Courier New">N</font><font face="宋体">为</font><font face="Courier New">1000000</font><font face="宋体">时结果对比：</font></span><span style="font-family: '宋体'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '宋体'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><img height="271" src="http://www.qingliangcn.com/blog/wp-content/uploads/wps_clip_image-824.png" width="543" /><span style="font-family: 'courier new'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '新宋体'; font-size: 10pt; mso-spacerun: 'yes'">结果取得是平均值，可以很明显的看出<font face="Courier New">comprehension</font><font face="新宋体">方式性能要高。</font></span><span style="font-family: '新宋体'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p15" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: '新宋体'; font-size: 10pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-family: 'times new roman'; font-size: 10pt; mso-spacerun: 'yes'">关于filter，则类似。不再作测试。</span></p>
<p><!--EndFragment--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/02/list-comprehensions%e4%b8%8elist-map%e6%80%a7%e8%83%bd%e5%af%b9%e6%af%94/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用新的域名 www.qingliangcn.com</title>
		<link>http://www.qingliangcn.com/2010/02/%e4%bd%bf%e7%94%a8%e6%96%b0%e7%9a%84%e5%9f%9f%e5%90%8d-www-qingliangcn-com/</link>
		<comments>http://www.qingliangcn.com/2010/02/%e4%bd%bf%e7%94%a8%e6%96%b0%e7%9a%84%e5%9f%9f%e5%90%8d-www-qingliangcn-com/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 04:43:49 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.nd21.com/?p=232</guid>
		<description><![CDATA[即日起使用新的域名 www.qingliangcn.com，原有域名保留一定时间。]]></description>
			<content:encoded><![CDATA[<p>即日起使用新的域名 <a href="http://www.qingliangcn.com">www.qingliangcn.com</a>，原有域名保留一定时间。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/02/%e4%bd%bf%e7%94%a8%e6%96%b0%e7%9a%84%e5%9f%9f%e5%90%8d-www-qingliangcn-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>虎年好运,新春愉快!</title>
		<link>http://www.qingliangcn.com/2010/02/%e8%99%8e%e5%b9%b4%e5%a5%bd%e8%bf%90%e6%96%b0%e6%98%a5%e6%84%89%e5%bf%ab/</link>
		<comments>http://www.qingliangcn.com/2010/02/%e8%99%8e%e5%b9%b4%e5%a5%bd%e8%bf%90%e6%96%b0%e6%98%a5%e6%84%89%e5%bf%ab/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 14:57:45 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>

		<guid isPermaLink="false">http://www.nd21.com/?p=230</guid>
		<description><![CDATA[虎年好运,新春愉快!]]></description>
			<content:encoded><![CDATA[<p>虎年好运,新春愉快!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/02/%e8%99%8e%e5%b9%b4%e5%a5%bd%e8%bf%90%e6%96%b0%e6%98%a5%e6%84%89%e5%bf%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>erlang tcp发包速度测试</title>
		<link>http://www.qingliangcn.com/2010/02/erlang-tcp%e5%8f%91%e5%8c%85%e9%80%9f%e5%ba%a6%e6%b5%8b%e8%af%95/</link>
		<comments>http://www.qingliangcn.com/2010/02/erlang-tcp%e5%8f%91%e5%8c%85%e9%80%9f%e5%ba%a6%e6%b5%8b%e8%af%95/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 08:34:57 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[erlang tcp io]]></category>

		<guid isPermaLink="false">http://www.nd21.com/?p=216</guid>
		<description><![CDATA[&#160; 这段时间我们的项目遇到广播包的一些性能问题，想起之前看到yufeng老大提到的1s广播40K包的问题，我也想测试测试我们机器的IO能力。 这次仅仅测试发包的能力，采用的是一对一的方式。 测试代码： -module(socket_io_test). -export([server/0,&#160;client/1]). server()&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;spawn(fun()&#160;-&#62;&#160;do_server()&#160;end). do_server()&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;gen_tcp:listen(38888,&#160;[binary,&#160;{reuseaddr,&#160;true},&#160;{active,&#160;false}])&#160;of &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ok,&#160;ListenSocket}&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;do_server_loop(ListenSocket); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{error,&#160;Reason}&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;io:format(&#34;listen&#160;38888&#160;failed:&#160;~p&#34;,&#160;[Reason]) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;end. do_server_loop(LSock)&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;gen_tcp:accept(LSock)&#160;of &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ok,&#160;ClientSocket}&#160;-&#62;&#160;do_recv(ClientSocket); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{error,&#160;Reason}&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;io:format(&#34;accept&#160;failed:&#160;~p&#34;,&#160;[Reason]) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;end. do_recv(ClientSocket)&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;gen_tcp:recv(ClientSocket,&#160;0), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;do_recv(ClientSocket). client(N)&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;gen_tcp:connect(&#34;127.0.0.1&#34;,&#160;38888,&#160;[binary])&#160;of &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{ok,&#160;Socket}&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;erlang:statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;erlang:statistics(wall_clock), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;do_send(N,&#160;Socket), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{_,&#160;T1}&#160;=&#160;erlang:statistics(runtime), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{_,&#160;T2}&#160;=&#160;erlang:statistics(wall_clock), &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;io:format(&#34;~p&#160;~p&#34;,&#160;[T1,&#160;T2]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{error,&#160;Reason}&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;io:format(&#34;connect&#160;failed:&#160;~p&#34;,&#160;[Reason]) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;end. do_send(N,&#160;Socket)&#160;-&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;lists:foreach(fun(_)&#160;-&#62;&#160;gen_tcp:send(Socket,&#160;&#60;&#60;&#34;Hello&#160;world!&#34;&#62;&#62;)&#160;end,&#160;lists:seq(1,&#160;N)). 启动服务端: socket_io_test:server(). 启动发包客户端： socket_io_test:client(100000).&#160;100000表示发包的数量，每个包的大小为12个字节，加上TCP头部，一共36字节。&#160; 测试包的数量：&#160;400000(40W) 服务器环境：&#160; Intel(R)&#160;Xeon(R)&#160;CPU&#160;&#160;&#160;E5420&#160;&#160;@&#160;2.50GHz&#160;双四核 12G内存 100M带宽独享 测试结果： runtime wall_clock -smp&#160;auto 650&#160; 1558 -smp&#160;auto&#160;+h&#160;99999 630 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<div class="Section0">
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">这段时间我们的项目遇到广播包的一些性能问题，想起之前看到<font face="Courier New">yufeng</font><font face="宋体">老大提到的</font><font face="Courier New">1s</font><font face="宋体">广播</font><font face="Courier New">40K</font><font face="宋体">包的问题，我也想测试测试我们机器的</font><font face="Courier New">IO</font><font face="宋体">能力。</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">这次仅仅测试发包的能力，采用的是一对一的方式。</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">测试代码：<span id="more-216"></span></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">-module(socket_io_test)</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">-export([server/</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">0</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;client/</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">1</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">])</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">server()&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spawn(</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">fun</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">()&nbsp;-&gt;&nbsp;do_server()&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">end</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">do_server()&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">case</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;gen_tcp:listen(</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">38888</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;[binary,&nbsp;{reuseaddr,&nbsp;true},&nbsp;{active,&nbsp;false}])&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">of</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ok,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ListenSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do_server_loop(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ListenSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">);</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{error,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Reason</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io:format(</span><span style="mso-spacerun:'yes'; color:rgb(188,143,143); font-size:10.0000pt; font-family:'Courier New'; ">&quot;listen&nbsp;38888&nbsp;failed:&nbsp;~p&quot;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;[</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Reason</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">])</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">end</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">do_server_loop(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">LSock</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">case</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;gen_tcp:accept(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">LSock</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">of</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ok,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ClientSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;-&gt;&nbsp;do_recv(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ClientSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">);</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{error,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Reason</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io:format(</span><span style="mso-spacerun:'yes'; color:rgb(188,143,143); font-size:10.0000pt; font-family:'Courier New'; ">&quot;accept&nbsp;failed:&nbsp;~p&quot;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;[</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Reason</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">])</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">end</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">do_recv(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ClientSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gen_tcp:recv(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ClientSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">0</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">),</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do_recv(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">ClientSocket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">client(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">case</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;gen_tcp:connect(</span><span style="mso-spacerun:'yes'; color:rgb(188,143,143); font-size:10.0000pt; font-family:'Courier New'; ">&quot;127.0.0.1&quot;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">38888</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;[binary])&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">of</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ok,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Socket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erlang:statistics(runtime),</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erlang:statistics(wall_clock),</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do_send(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Socket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">),</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">_</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">T1</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;=&nbsp;erlang:statistics(runtime),</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">_</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">T2</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;=&nbsp;erlang:statistics(wall_clock),</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io:format(</span><span style="mso-spacerun:'yes'; color:rgb(188,143,143); font-size:10.0000pt; font-family:'Courier New'; ">&quot;~p&nbsp;~p&quot;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;[</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">T1</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">T2</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">]);</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{error,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Reason</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">}&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io:format(</span><span style="mso-spacerun:'yes'; color:rgb(188,143,143); font-size:10.0000pt; font-family:'Courier New'; ">&quot;connect&nbsp;failed:&nbsp;~p&quot;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;[</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Reason</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">])</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">end</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">do_send(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Socket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lists:foreach(</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">fun</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">_</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;&nbsp;gen_tcp:send(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Socket</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;&lt;&lt;</span><span style="mso-spacerun:'yes'; color:rgb(188,143,143); font-size:10.0000pt; font-family:'Courier New'; ">&quot;Hello&nbsp;world!&quot;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&gt;&gt;)&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">end</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;lists:seq(</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">1</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">))</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'宋体'; ">启动服务端<font face="Courier New">:</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">socket_io_test</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">:server().</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">启动发包客户端：</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">socket_io_test</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">:client(100000).&nbsp;100000<font face="宋体">表示发包的数量，每个包的大小为</font><font face="Courier New">12</font><font face="宋体">个字节，加上</font><font face="Courier New">TCP</font><font face="宋体">头部，一共</font><font face="Courier New">36</font><font face="宋体">字节。&nbsp;</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">测试包的数量：&nbsp;<font face="Courier New">400000(40W)</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">服务器环境：&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">Intel(R)&nbsp;Xeon(R)&nbsp;CPU&nbsp;&nbsp;&nbsp;E5420&nbsp;&nbsp;@&nbsp;2.50GHz&nbsp;<font face="宋体">双四核</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">12G<font face="宋体">内存</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">100M<font face="宋体">带宽独享</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">测试结果：</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<table style="border-collapse:collapse;<br />
mso-table-layout-alt:fixed;<br />
padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; "><br />
<tbody>
<tr style="height:26.0000pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:0.5000pt solid rgb(0,0,0); border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:0.5000pt solid rgb(0,0,0); border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">runtime</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:0.5000pt solid rgb(0,0,0); border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">wall_clock</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:32.7500pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">-smp&nbsp;auto</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">650&nbsp;</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">1558</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:32.7500pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">-smp&nbsp;auto&nbsp;+h&nbsp;99999</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">630</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">1641</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:35.0000pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">+K&nbsp;true&nbsp;</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">670&nbsp;</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">1626</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:34.7500pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">-smp&nbsp;disable</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">410</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">770</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:37.0000pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">+K&nbsp;true&nbsp;-smp&nbsp;disable</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">430</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">797</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:40.0000pt; ">
<td style="width:276.9500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:0.5000pt solid rgb(0,0,0); border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="369">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">+K&nbsp;true&nbsp;-smp&nbsp;disable&nbsp;+h&nbsp;99999</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:79.5000pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="106">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">420</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
<td style="width:75.7500pt; padding:0.0000pt 5.4000pt 0.0000pt 5.4000pt ; border-left:none; ; border-right:0.5000pt solid rgb(0,0,0); border-top:none; ; border-bottom:0.5000pt solid rgb(0,0,0); " valign="top" width="101">
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">1133</span><span style="color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">结果表明&nbsp;<font face="Courier New">smp&nbsp;disable</font><font face="宋体">模式下发包速度明显快于</font><font face="Courier New">smp&nbsp;auto</font><font face="宋体">模式，原因在于多核模式下，</font><font face="Courier New">CPU</font><font face="宋体">切换的代价是相当高的。另外由于是一对一的发包，所以</font><font face="Courier New">+K</font><font face="宋体">参数也没有什么效果。</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">产生的问题：</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">多核并发<font face="Courier New">IO</font><font face="宋体">是否没有优势？得去看看</font><font face="Courier New">Linux</font><font face="宋体">底层的实现了。（原谅我对这块的无知）</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">1.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">如果多核并发进行网络<font face="Courier New">IO</font><font face="宋体">的能力要弱于单核，那么在用</font><font face="Courier New">erlang</font><font face="宋体">进行服务端设计的时候就应该尽量让网关独占某个</font><font face="Courier New">CPU</font><font face="宋体">并设置为</font><font face="Courier New">-smp&nbsp;disable</font><font face="宋体">模式。</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">2.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">如果有优势，如何利用呢？嗯，这又是一个问题。</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/02/erlang-tcp%e5%8f%91%e5%8c%85%e9%80%9f%e5%ba%a6%e6%b5%8b%e8%af%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

