Skip to content

Commit 0ff3074

Browse files
committed
更新
1 parent 59320a6 commit 0ff3074

8 files changed

+184
-37
lines changed

api/child.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ <h2 id="相关函数"><a href="#相关函数" class="headerlink" title="相关
4646
<p>配置<code>ev_child</code>观察<code>pid</code>指向的子进程ID的状态变化.可以在回调函数里通过观察<code>rstatus</code>成员来查看状态(使用<code>sys/wait.h</code>中的宏并查看您的系统<code>waitpid</code>文档), <code>rpid</code>成员包含了导致变换的进程<code>ID</code>. <code>trace</code>则必须是<code>0</code>或者<code>1</code>.<br><code>trace</code><code>0</code>表示仅关注进程终止的状态.<br><code>trace</code><code>1</code>表示仅关注进程暂停、继续的状态.</p>
4747
</blockquote>
4848
<h3 id="int-pid-read-only"><a href="#int-pid-read-only" class="headerlink" title="int pid [read-only]"></a>int pid [read-only]</h3><blockquote>
49-
<p>表示关注的<code>pid</code>; 为<code>0</code>表示监视所有资金进程.</p>
49+
<p>表示关注的<code>pid</code>; 为<code>0</code>表示监视所有子进程.</p>
5050
</blockquote>
5151
<h3 id="int-rpid-read-only"><a href="#int-rpid-read-only" class="headerlink" title="int rpid [read-only]"></a>int rpid [read-only]</h3><blockquote>
5252
<p>表示检测到状态变更的子进程<code>ID</code>.</p>

api/idle.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
<div id="page-content" class="doc-formatting">
3636
<h2 id="基本介绍"><a href="#基本介绍" class="headerlink" title="基本介绍"></a>基本介绍</h2><p> <code>ev_idle</code>在没有更高优先级的事件后触发.</p>
3737
<h3 id="当没有别的事情做了…"><a href="#当没有别的事情做了…" class="headerlink" title="当没有别的事情做了…"></a>当没有别的事情做了…</h3><p> 只要您的进程忙于处理具有相同或更高优先级的<code>socket</code><code>Timer</code><code>signal</code><code>ev_idle</code>在此期间就不会被触发.</p>
38-
<p> 而一旦您的进程长期处于<strong>空闲状态</strong>,<code>ev_idle</code>则会在每次事件迭代中被调用一次直到被主动停止. 或者, 您的进程在此期间被更高优先级的事件所占用.</p>
39-
<p> <code>ev_idle</code>还有一个应用场景就是可以做为<code>伪后台程序</code>的方式运行, 比如在事件处理完毕之后做一些需要延迟善后的工作.</p>
38+
<p> 而一旦您的进程(长期)处于<strong>空闲状态</strong>, <code>ev_idle</code>则会在每次事件迭代中被调用一次直到被主动停止.</p>
39+
<p> <code>ev_idle</code>还有一个应用场景就是可以做为<code>伪后台程序</code>的方式运行, 并且为其完成一些需要延迟善后的工作.</p>
4040
<h2 id="相关函数"><a href="#相关函数" class="headerlink" title="相关函数"></a>相关函数</h2><h3 id="ev-idle-init-ev-idle-callback"><a href="#ev-idle-init-ev-idle-callback" class="headerlink" title="ev_idle_init (ev_idle *, callback)"></a>ev_idle_init (ev_idle *, callback)</h3><h3 id="ev-idle-start-struct-ev-loop-ev-idle"><a href="#ev-idle-start-struct-ev-loop-ev-idle" class="headerlink" title="ev_idle_start (struct ev_loop , ev_idle )"></a>ev_idle_start (struct ev_loop <em>, ev_idle </em>)</h3><blockquote>
4141
<p>初始化、激活<code>ev_idle</code>, 他没有任何其他有意义的参数. <code>ev_set_idle</code>也没有什么意义.</p>
4242
</blockquote>

api/io.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
<h2 id="基本介绍"><a href="#基本介绍" class="headerlink" title="基本介绍"></a>基本介绍</h2><p> <code>ev_io</code>是这对<code>I/O</code>观察者, 通过注册组合事件来监视状态变更.</p>
3737
<h3 id="1-文件描述符的”读”与”写”"><a href="#1-文件描述符的”读”与”写”" class="headerlink" title="1. 文件描述符的”读”与”写”"></a>1. 文件描述符的”读”与”写”</h3><p> <code>I/O</code>观察者会在每次事件循环迭代中检查注册的文件描述符是否可读、可写. 准确来说:</p>
3838
<ul>
39-
<li><p>每次报告<strong>“读”</strong>事件时, 要么内核缓冲区有可被读取的数据, 要么文件描述符状态变更(关闭、出错)等.</p>
39+
<li><p>每次报告<strong></strong>事件时, 要么内核缓冲区有可被读取的数据, 要么文件描述符状态变更(关闭、出错)等.</p>
4040
</li>
41-
<li><p>每次报告<strong>“写”</strong>事件时, 要么内核缓冲区空闲可被写入数据, 要么文件描述符状态变更(连接建立、失败)等.</p>
41+
<li><p>每次报告<strong></strong>事件时, 要么内核缓冲区空闲可被写入数据, 要么文件描述符状态变更(连接建立、失败)等.</p>
4242
</li>
4343
</ul>
44-
<p> 如果期间对事件后不做任何处理(关闭、停止), 那么观察者每次都会重复的报告事件. 这种行为我们称之为”<code>level-triggering</code>(水平触发)”.</p>
44+
<p> 如果期间对事件后不做任何处理(关闭、停止), 那么观察者每次都会重复的报告事件. 这种行为我们称之为”<code>level-triggering</code>(<code>水平触发</code>)”.</p>
4545
<p> 通常我们打开/创建的文件描述符的默认是<strong>阻塞</strong>(<code>block</code>), 这意味着我们每次读取数据时都会将进程陷入到内核态. 所以将所有文件描述符都设置为非阻塞模式一般来说是一个好主意.</p>
4646
<p> 但, 当您的文件描述符<strong>无法在非阻塞模式下运行</strong>, 那么您必须自己解决如下一些问题:</p>
4747
<ul>

api/loop.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<h2 id="基本介绍"><a href="#基本介绍" class="headerlink" title="基本介绍"></a>基本介绍</h2><p> <code>Libev</code>的事件循环对象由<code>struct ev_loop</code>定义.</p>
3737
<h2 id="相关函数"><a href="#相关函数" class="headerlink" title="相关函数"></a>相关函数</h2><h3 id="1-struct-ev-loop-ev-default-loop-unsigned-int-flags"><a href="#1-struct-ev-loop-ev-default-loop-unsigned-int-flags" class="headerlink" title="1. struct ev_loop *ev_default_loop (unsigned int flags)"></a>1. struct ev_loop *ev_default_loop (unsigned int flags)</h3><p> 此函数将返回”<strong>默认</strong>“的<code>ev_loop</code>对象并初始化, 如果您不知道使用哪个事件循环, 请使用这个函数返回的<code>ev_loop</code>对象(或通过EV_DEFAULT宏).</p>
3838
<p> 如果<code>ev_loop</code>已经被初始化, 那么再(多)次调用都只会简单返回同一个对象(即使<code>flags</code>不同). 如果尚未初始化, 那么将会根据<code>flags</code>创建它.</p>
39-
<p> 注意: 此函数不是线程安全的. 所以, 要在多线程使用的时候必须加上互斥锁保证操作的原子性(虽然这种情况极少). 同时”<strong>缺省</strong>“的<code>ev_loop</code>对象才可以处理<code>ev_child</code>.</p>
39+
<p> <strong>注意</strong>: 此函数不是线程安全的. 所以, 要在多线程使用的时候必须加上互斥锁保证操作的原子性(虽然这种情况极少). 同时”<strong>缺省</strong>“的<code>ev_loop</code>对象才可以处理<code>ev_child</code>.</p>
4040
<p> 示例: </p>
4141
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> (!ev_default_loop (<span class="number">0</span>))</span><br><span class="line"> fatal (<span class="string">"could not initialise libev, bad $LIBEV_FLAGS in environment?"</span>);</span><br></pre></td></tr></table></figure>
4242
<p> 限制<code>Libev</code>仅使用<code>select</code><code>poll</code>后端同时忽略环境配置的示例:</p>

baidusitemap.xml

+148-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,150 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3-
</urlset>
3+
4+
<url>
5+
<loc>https://libev.cn/api/loop.html</loc>
6+
7+
<lastmod>2023-05-09</lastmod>
8+
9+
<changefreq>monthly</changefreq>
10+
<priority>0.6</priority>
11+
</url>
12+
13+
<url>
14+
<loc>https://libev.cn/api/io.html</loc>
15+
16+
<lastmod>2023-05-09</lastmod>
17+
18+
<changefreq>monthly</changefreq>
19+
<priority>0.6</priority>
20+
</url>
21+
22+
<url>
23+
<loc>https://libev.cn/api/idle.html</loc>
24+
25+
<lastmod>2023-05-09</lastmod>
26+
27+
<changefreq>monthly</changefreq>
28+
<priority>0.6</priority>
29+
</url>
30+
31+
<url>
32+
<loc>https://libev.cn/api/child.html</loc>
33+
34+
<lastmod>2023-05-09</lastmod>
35+
36+
<changefreq>monthly</changefreq>
37+
<priority>0.6</priority>
38+
</url>
39+
40+
<url>
41+
<loc>https://libev.cn/index.html</loc>
42+
43+
<lastmod>2022-03-21</lastmod>
44+
45+
<changefreq>monthly</changefreq>
46+
<priority>0.6</priority>
47+
</url>
48+
49+
<url>
50+
<loc>https://libev.cn/api/timer.html</loc>
51+
52+
<lastmod>2022-03-21</lastmod>
53+
54+
<changefreq>monthly</changefreq>
55+
<priority>0.6</priority>
56+
</url>
57+
58+
<url>
59+
<loc>https://libev.cn/other/micro.html</loc>
60+
61+
<lastmod>2022-03-21</lastmod>
62+
63+
<changefreq>monthly</changefreq>
64+
<priority>0.6</priority>
65+
</url>
66+
67+
<url>
68+
<loc>https://libev.cn/other/threads.html</loc>
69+
70+
<lastmod>2022-03-20</lastmod>
71+
72+
<changefreq>monthly</changefreq>
73+
<priority>0.6</priority>
74+
</url>
75+
76+
<url>
77+
<loc>https://libev.cn/other/compiler.html</loc>
78+
79+
<lastmod>2022-03-20</lastmod>
80+
81+
<changefreq>monthly</changefreq>
82+
<priority>0.6</priority>
83+
</url>
84+
85+
<url>
86+
<loc>https://libev.cn/other/memcheck.html</loc>
87+
88+
<lastmod>2022-03-20</lastmod>
89+
90+
<changefreq>monthly</changefreq>
91+
<priority>0.6</priority>
92+
</url>
93+
94+
<url>
95+
<loc>https://libev.cn/other/algorithm.html</loc>
96+
97+
<lastmod>2022-03-20</lastmod>
98+
99+
<changefreq>monthly</changefreq>
100+
<priority>0.6</priority>
101+
</url>
102+
103+
<url>
104+
<loc>https://libev.cn/base/install.html</loc>
105+
106+
<lastmod>2022-03-20</lastmod>
107+
108+
<changefreq>monthly</changefreq>
109+
<priority>0.6</priority>
110+
</url>
111+
112+
<url>
113+
<loc>https://libev.cn/api/stat.html</loc>
114+
115+
<lastmod>2022-03-20</lastmod>
116+
117+
<changefreq>monthly</changefreq>
118+
<priority>0.6</priority>
119+
</url>
120+
121+
<url>
122+
<loc>https://libev.cn/api/signal.html</loc>
123+
124+
<lastmod>2022-03-20</lastmod>
125+
126+
<changefreq>monthly</changefreq>
127+
<priority>0.6</priority>
128+
</url>
129+
130+
<url>
131+
<loc>https://libev.cn/base/used.html</loc>
132+
133+
<lastmod>2022-03-14</lastmod>
134+
135+
<changefreq>monthly</changefreq>
136+
<priority>0.6</priority>
137+
</url>
138+
139+
140+
<url>
141+
<loc>https://libev.cn/</loc>
142+
<lastmod>2023-05-09</lastmod>
143+
<changefreq>daily</changefreq>
144+
<priority>1.0</priority>
145+
</url>
146+
147+
148+
149+
150+
</urlset>

lunr.json

+1-1
Large diffs are not rendered by default.

sitemap.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
https://libev.cn/api/loop.html
2+
https://libev.cn/api/io.html
3+
https://libev.cn/api/idle.html
4+
https://libev.cn/api/child.html
15
https://libev.cn/index.html
26
https://libev.cn/api/timer.html
37
https://libev.cn/other/micro.html
@@ -6,11 +10,7 @@ https://libev.cn/other/compiler.html
610
https://libev.cn/other/memcheck.html
711
https://libev.cn/other/algorithm.html
812
https://libev.cn/base/install.html
9-
https://libev.cn/api/idle.html
1013
https://libev.cn/api/stat.html
11-
https://libev.cn/api/child.html
1214
https://libev.cn/api/signal.html
13-
https://libev.cn/api/io.html
14-
https://libev.cn/api/loop.html
1515
https://libev.cn/base/used.html
1616
https://libev.cn/

sitemap.xml

+24-24
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,70 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33

44
<url>
5-
<loc>https://libev.cn/index.html</loc>
5+
<loc>https://libev.cn/api/loop.html</loc>
66

7-
<lastmod>2022-03-21</lastmod>
7+
<lastmod>2023-05-09</lastmod>
88

99
<changefreq>monthly</changefreq>
1010
<priority>0.6</priority>
1111
</url>
1212

1313
<url>
14-
<loc>https://libev.cn/api/timer.html</loc>
14+
<loc>https://libev.cn/api/io.html</loc>
1515

16-
<lastmod>2022-03-21</lastmod>
16+
<lastmod>2023-05-09</lastmod>
1717

1818
<changefreq>monthly</changefreq>
1919
<priority>0.6</priority>
2020
</url>
2121

2222
<url>
23-
<loc>https://libev.cn/other/micro.html</loc>
23+
<loc>https://libev.cn/api/idle.html</loc>
2424

25-
<lastmod>2022-03-21</lastmod>
25+
<lastmod>2023-05-09</lastmod>
2626

2727
<changefreq>monthly</changefreq>
2828
<priority>0.6</priority>
2929
</url>
3030

3131
<url>
32-
<loc>https://libev.cn/other/threads.html</loc>
32+
<loc>https://libev.cn/api/child.html</loc>
3333

34-
<lastmod>2022-03-20</lastmod>
34+
<lastmod>2023-05-09</lastmod>
3535

3636
<changefreq>monthly</changefreq>
3737
<priority>0.6</priority>
3838
</url>
3939

4040
<url>
41-
<loc>https://libev.cn/other/compiler.html</loc>
41+
<loc>https://libev.cn/index.html</loc>
4242

43-
<lastmod>2022-03-20</lastmod>
43+
<lastmod>2022-03-21</lastmod>
4444

4545
<changefreq>monthly</changefreq>
4646
<priority>0.6</priority>
4747
</url>
4848

4949
<url>
50-
<loc>https://libev.cn/other/memcheck.html</loc>
50+
<loc>https://libev.cn/api/timer.html</loc>
5151

52-
<lastmod>2022-03-20</lastmod>
52+
<lastmod>2022-03-21</lastmod>
5353

5454
<changefreq>monthly</changefreq>
5555
<priority>0.6</priority>
5656
</url>
5757

5858
<url>
59-
<loc>https://libev.cn/other/algorithm.html</loc>
59+
<loc>https://libev.cn/other/micro.html</loc>
6060

61-
<lastmod>2022-03-20</lastmod>
61+
<lastmod>2022-03-21</lastmod>
6262

6363
<changefreq>monthly</changefreq>
6464
<priority>0.6</priority>
6565
</url>
6666

6767
<url>
68-
<loc>https://libev.cn/base/install.html</loc>
68+
<loc>https://libev.cn/other/threads.html</loc>
6969

7070
<lastmod>2022-03-20</lastmod>
7171

@@ -74,7 +74,7 @@
7474
</url>
7575

7676
<url>
77-
<loc>https://libev.cn/api/idle.html</loc>
77+
<loc>https://libev.cn/other/compiler.html</loc>
7878

7979
<lastmod>2022-03-20</lastmod>
8080

@@ -83,7 +83,7 @@
8383
</url>
8484

8585
<url>
86-
<loc>https://libev.cn/api/stat.html</loc>
86+
<loc>https://libev.cn/other/memcheck.html</loc>
8787

8888
<lastmod>2022-03-20</lastmod>
8989

@@ -92,7 +92,7 @@
9292
</url>
9393

9494
<url>
95-
<loc>https://libev.cn/api/child.html</loc>
95+
<loc>https://libev.cn/other/algorithm.html</loc>
9696

9797
<lastmod>2022-03-20</lastmod>
9898

@@ -101,7 +101,7 @@
101101
</url>
102102

103103
<url>
104-
<loc>https://libev.cn/api/signal.html</loc>
104+
<loc>https://libev.cn/base/install.html</loc>
105105

106106
<lastmod>2022-03-20</lastmod>
107107

@@ -110,18 +110,18 @@
110110
</url>
111111

112112
<url>
113-
<loc>https://libev.cn/api/io.html</loc>
113+
<loc>https://libev.cn/api/stat.html</loc>
114114

115-
<lastmod>2022-03-19</lastmod>
115+
<lastmod>2022-03-20</lastmod>
116116

117117
<changefreq>monthly</changefreq>
118118
<priority>0.6</priority>
119119
</url>
120120

121121
<url>
122-
<loc>https://libev.cn/api/loop.html</loc>
122+
<loc>https://libev.cn/api/signal.html</loc>
123123

124-
<lastmod>2022-03-19</lastmod>
124+
<lastmod>2022-03-20</lastmod>
125125

126126
<changefreq>monthly</changefreq>
127127
<priority>0.6</priority>
@@ -139,7 +139,7 @@
139139

140140
<url>
141141
<loc>https://libev.cn/</loc>
142-
<lastmod>2022-03-24</lastmod>
142+
<lastmod>2023-05-09</lastmod>
143143
<changefreq>daily</changefreq>
144144
<priority>1.0</priority>
145145
</url>

0 commit comments

Comments
 (0)