-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphp.daemon.xml
737 lines (681 loc) · 20.2 KB
/
php.daemon.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN"
"/usr/share/xml/docbook/schema/dtd/5.0/docbook.dtd" [
<!ENTITY article.author.xml SYSTEM "../common/article.author.xml">
<!ENTITY book.info.legalnotice.xml SYSTEM "../common/book.info.legalnotice.xml">
<!ENTITY book.info.abstract.xml SYSTEM "../common/book.info.abstract.xml">
]>
<article xml:base="http://netkiller.github.io/journal/"
xmlns="http://docbook.org/ns/docbook" xml:lang="zh-cn">
<articleinfo>
<title>PHP高级编程之守护进程</title>
<subtitle>http://netkiller.github.io/journal/php.daemon.html</subtitle>
<subsubtitle></subsubtitle>
&article.author.xml;
<copyright>
<year>2014</year>
<holder>http://netkiller.github.io</holder>
</copyright>
&book.info.legalnotice.xml;
<abstract>
<para>2014-09-01 发表</para>
<para>2015-08-31 更新</para>
<para>2015-10-20 更新,增加优雅重启</para>
</abstract>
&book.info.abstract.xml;
<keywordset>
<keyword>PHP守护进程</keyword>
<keyword>PHP多线程</keyword>
<keyword>PHP多进程</keyword>
<keyword></keyword>
</keywordset>
<pubdate>2014-09-01</pubdate>
<release>$Id$</release>
</articleinfo>
<section id="what">
<title>什么是守护进程</title>
<para> 守护进程是脱离于终端并且在后台运行的进程。守护进程脱离于终端是为了避免进程在执行过程中的信息在任何终端上显示并且进程也不会被任何终端所产生的终端信息所打断。</para>
<para>例如 apache, nginx, mysql 都是守护进程</para>
</section>
<section id="why">
<title>为什么开发守护进程</title>
<para>很多程序以服务形式存在,他没有终端或UI交互,它可能采用其他方式与其他程序交互,如TCP/UDP Socket, UNIX Socket, fifo。程序一旦启动便进入后台,直到满足条件他便开始处理任务。</para>
</section>
<section id="when">
<title>何时采用守护进程开发应用程序</title>
<para>以我当前的需求为例,我需要运行一个程序,然后监听某端口,持续接受服务端发起的数据,然后对数据分析处理,再将结果写入到数据库中; 我采用ZeroMQ实现数据收发。</para>
<para>如果我不采用守护进程方式开发该程序,程序一旦运行就会占用当前终端窗框,还有受到当前终端键盘输入影响,有可能程序误退出。</para>
</section>
<section id="security">
<title>守护进程的安全问题</title>
<para>我们希望程序在非超级用户运行,这样一旦由于程序出现漏洞被骇客控制,攻击者只能继承运行权限,而无法获得超级用户权限。</para>
<para>我们希望程序只能运行一个实例,不运行同事开启两个以上的程序,因为会出现端口冲突等等问题。</para>
</section>
<!--
<section id="who">
<title>who-谁去做</title>
</section>
-->
<section id="how">
<title>怎样开发守护进程</title>
<example>
<title>多线程守护进程例示</title>
<programlisting>
<![CDATA[
<?php
class ExampleWorker extends Worker {
#public function __construct(Logging $logger) {
# $this->logger = $logger;
#}
#protected $logger;
protected static $dbh;
public function __construct() {
}
public function run(){
$dbhost = '192.168.2.1'; // 数据库服务器
$dbport = 3306;
$dbuser = 'www'; // 数据库用户名
$dbpass = 'qwer123'; // 数据库密码
$dbname = 'example'; // 数据库名
self::$dbh = new PDO("mysql:host=$dbhost;port=$dbport;dbname=$dbname", $dbuser, $dbpass, array(
/* PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'', */
PDO::MYSQL_ATTR_COMPRESS => true,
PDO::ATTR_PERSISTENT => true
)
);
}
protected function getInstance(){
return self::$dbh;
}
}
/* the collectable class implements machinery for Pool::collect */
class Fee extends Stackable {
public function __construct($msg) {
$trades = explode(",", $msg);
$this->data = $trades;
print_r($trades);
}
public function run() {
#$this->worker->logger->log("%s executing in Thread #%lu", __CLASS__, $this->worker->getThreadId() );
try {
$dbh = $this->worker->getInstance();
$insert = "INSERT INTO fee(ticket, login, volume, `status`) VALUES(:ticket, :login, :volume,'N')";
$sth = $dbh->prepare($insert);
$sth->bindValue(':ticket', $this->data[0]);
$sth->bindValue(':login', $this->data[1]);
$sth->bindValue(':volume', $this->data[2]);
$sth->execute();
$sth = null;
/* ...... */
$update = "UPDATE fee SET `status` = 'Y' WHERE ticket = :ticket and `status` = 'N'";
$sth = $dbh->prepare($update);
$sth->bindValue(':ticket', $this->data[0]);
$sth->execute();
//echo $sth->queryString;
//$dbh = null;
}
catch(PDOException $e) {
$error = sprintf("%s,%s\n", $mobile, $id );
file_put_contents("mobile_error.log", $error, FILE_APPEND);
}
}
}
class Example {
/* config */
const LISTEN = "tcp://192.168.2.15:5555";
const MAXCONN = 100;
const pidfile = __CLASS__;
const uid = 80;
const gid = 80;
protected $pool = NULL;
protected $zmq = NULL;
public function __construct() {
$this->pidfile = '/var/run/'.self::pidfile.'.pid';
}
private function daemon(){
if (file_exists($this->pidfile)) {
echo "The file $this->pidfile exists.\n";
exit();
}
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
//pcntl_wait($status); //Protect against Zombie children
exit($pid);
} else {
// we are the child
file_put_contents($this->pidfile, getmypid());
posix_setuid(self::uid);
posix_setgid(self::gid);
return(getmypid());
}
}
private function start(){
$pid = $this->daemon();
$this->pool = new Pool(self::MAXCONN, \ExampleWorker::class, []);
$this->zmq = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REP);
$this->zmq->bind(self::LISTEN);
/* Loop receiving and echoing back */
while ($message = $this->zmq->recv()) {
//print_r($message);
//if($trades){
$this->pool->submit(new Fee($message));
$this->zmq->send('TRUE');
//}else{
// $this->zmq->send('FALSE');
//}
}
$pool->shutdown();
}
private function stop(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
posix_kill($pid, 9);
unlink($this->pidfile);
}
}
private function help($proc){
printf("%s start | stop | help \n", $proc);
}
public function main($argv){
if(count($argv) < 2){
printf("please input help parameter\n");
exit();
}
if($argv[1] === 'stop'){
$this->stop();
}else if($argv[1] === 'start'){
$this->start();
}else{
$this->help($argv[0]);
}
}
}
$cgse = new Example();
$cgse->main($argv);
]]>
</programlisting>
</example>
<example>
<title>消息队列与守护进程</title>
<programlisting>
<![CDATA[
<?php
declare(ticks = 1);
require_once( __DIR__.'/autoload.class.php' );
umask(077);
class EDM {
protected $queue;
public function __construct() {
global $argc, $argv;
$this->argc = $argc;
$this->argv = $argv;
$this->pidfile = $this->argv[0].".pid";
$this->config = new Config('mq');
$this->logging = new Logging(__DIR__.'/log/'.$this->argv[0].'.'.date('Y-m-d').'.log'); //.H:i:s
//print_r( $this->config->getArray('mq') );
//pcntl_signal(SIGHUP, array(&$this,"restart"));
}
protected function msgqueue(){
$exchangeName = 'email'; //交换机名
$queueName = 'email'; //队列名
$routeKey = 'email'; //路由key
//创建连接和channel
$connection = new AMQPConnection($this->config->getArray('mq'));
if (!$connection->connect()) {
die("Cannot connect to the broker!\n");
}
$this->channel = new AMQPChannel($connection);
$this->exchange = new AMQPExchange($this->channel);
$this->exchange->setName($exchangeName);
$this->exchange->setType(AMQP_EX_TYPE_DIRECT); //direct类型
$this->exchange->setFlags(AMQP_DURABLE); //持久化
$this->exchange->declare();
//echo "Exchange Status:".$this->exchange->declare()."\n";
//创建队列
$this->queue = new AMQPQueue($this->channel);
$this->queue->setName($queueName);
$this->queue->setFlags(AMQP_DURABLE); //持久化
$this->queue->declare();
//echo "Message Total:".$this->queue->declare()."\n";
//绑定交换机与队列,并指定路由键
$bind = $this->queue->bind($exchangeName, $routeKey);
//echo 'Queue Bind: '.$bind."\n";
//阻塞模式接收消息
while(true){
//$this->queue->consume('processMessage', AMQP_AUTOACK); //自动ACK应答
$this->queue->consume(function($envelope, $queue) {
$msg = $envelope->getBody();
$queue->ack($envelope->getDeliveryTag()); //手动发送ACK应答
$this->logging->info('('.'+'.')'.$msg);
//$this->logging->debug("Message Total:".$this->queue->declare());
});
$this->channel->qos(0,1);
//echo "Message Total:".$this->queue->declare()."\n";
}
$conn->disconnect();
}
protected function start(){
if (file_exists($this->pidfile)) {
printf("%s already running\n", $this->argv[0]);
exit(0);
}
$this->logging->warning("start");
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
//pcntl_wait($status); //等待子进程中断,防止子进程成为僵尸进程。
exit(0);
} else {
posix_setsid();
//printf("pid: %s\n", posix_getpid());
file_put_contents($this->pidfile, posix_getpid());
//posix_kill(posix_getpid(), SIGHUP);
$this->msgqueue();
}
}
protected function stop(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
posix_kill($pid, SIGTERM);
//posix_kill($pid, SIGKILL);
unlink($this->pidfile);
$this->logging->warning("stop");
}else{
printf("%s haven't running\n", $this->argv[0]);
}
}
protected function restart(){
$this->stop();
$this->start();
}
protected function status(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
printf("%s already running, pid = %s\n", $this->argv[0], $pid);
}else{
printf("%s haven't running\n", $this->argv[0]);
}
}
protected function usage(){
printf("Usage: %s {start | stop | restart | status}\n", $this->argv[0]);
}
public function main(){
//print_r($this->argv);
if($this->argc != 2){
$this->usage();
}else{
if($this->argv[1] == 'start'){
$this->start();
}else if($this->argv[1] == 'stop'){
$this->stop();
}else if($this->argv[1] == 'restart'){
$this->restart();
}else if($this->argv[1] == 'status'){
$this->status();
}else{
$this->usage();
}
}
}
}
$edm = New EDM();
$edm->main();
]]>
</programlisting>
</example>
<section>
<title>程序启动</title>
<para>下面是程序启动后进入后台的代码</para>
<para>通过进程ID文件来判断,当前进程状态,如果进程ID文件存在表示程序在运行中,通过代码file_exists($this->pidfile)实现,但而后进程被kill需要手工删除该文件才能运行</para>
<programlisting>
<![CDATA[
private function daemon(){
if (file_exists($this->pidfile)) {
echo "The file $this->pidfile exists.\n";
exit();
}
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
//pcntl_wait($status); //Protect against Zombie children
exit($pid);
} else {
// we are the child
file_put_contents($this->pidfile, getmypid());
posix_setuid(self::uid);
posix_setgid(self::gid);
return(getmypid());
}
}
]]>
</programlisting>
<para>程序启动后,父进程会推出,子进程会在后台运行,子进程权限从root切换到指定用户,同时将pid写入进程ID文件。</para>
</section>
<section>
<title>程序停止</title>
<para>程序停止,只需读取pid文件,然后调用posix_kill($pid, 9); 最后将该文件删除。</para>
<programlisting>
<![CDATA[
private function stop(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
posix_kill($pid, 9);
unlink($this->pidfile);
}
}
]]>
</programlisting>
</section>
<section>
<title>单例模式</title>
<para>所有线程共用数据库连接,在多线程中这个非常重要,如果每个线程建立以此数据库连接在关闭,这对数据库的开销是巨大的。</para>
<screen>
protected function getInstance(){
return self::$dbh;
}
</screen>
</section>
<section>
<title>实现优雅重启</title>
<para>所谓优雅重启是指进程不退出的情况加实现重新载入包含重置变量,刷新配置文件,重置日志等等</para>
<para>stop/start 或者 restart都会退出进程,重新启动,导致进程ID改变,同时瞬间退出导致业务闪断。所以很多守护进程都会提供一个reload功能,者就是所谓的优雅重启。</para>
<para>reload 实现原理是给进程发送SIGHUP信号,可以通过kill命令发送 kill -s SIGHUP 64881,也可以通过库函数实现 posix_kill(posix_getpid(), SIGUSR1);</para>
<screen>
<![CDATA[
<?php
pcntl_signal(SIGTERM, function($signo) {
echo "\n This signal is called. [$signo] \n";
Status::$state = -1;
});
pcntl_signal(SIGHUP, function($signo) {
echo "\n This signal is called. [$signo] \n";
Status::$state = 1;
Status::$ini = parse_ini_file('test.ini');
});
class Status{
public static $state = 0;
public static $ini = null;
}
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
}
if($pid) {
// parent
} else {
$loop = true;
Status::$ini = parse_ini_file('test.ini');
while($loop) {
print_r(Status::$ini);
while(true) {
// Dispatching...
pcntl_signal_dispatch();
if(Status::$state == -1) {
// Do something and end loop.
$loop = false;
break;
}
if(Status::$state == 1) {
printf("This program is reload.\r\n");
Status::$state = 0;
break;
}
echo '.';
sleep(1);
}
echo "\n";
}
echo "Finish \n";
exit();
}
]]>
</screen>
<para>创建配置文件</para>
<screen>
[root@netkiller pcntl]# cat test.ini
[db]
host=192.168.0.1
port=3306
</screen>
<para>测试方法,首先运行该守护进程</para>
<screen>
# php signal.reload.php
Array
(
[host] => 192.168.0.1
[port] => 3306
)
</screen>
<para>现在修改配置文件,增加user=test配置项</para>
<screen>
[root@netkiller pcntl]# cat test.ini
[db]
host=192.168.0.1
port=3306
user=test
</screen>
<para>发送信号,在另一个终端窗口,通过ps命令找到该进程的PID,然后使用kill命令发送SIGHUP信号,然后再通过ps查看进程,你会发现进程PID没有改变</para>
<screen>
[root@netkiller pcntl]# ps ax | grep reload
64881 pts/0 S 0:00 php -c /srv/php/etc/php-cli.ini signal.reload.php
65073 pts/1 S+ 0:00 grep --color=auto reload
[root@netkiller pcntl]# kill -s SIGHUP 64881
[root@netkiller pcntl]# ps ax | grep reload
64881 pts/0 S 0:00 php -c /srv/php/etc/php-cli.ini signal.reload.php
65093 pts/1 S+ 0:00 grep --color=auto reload
</screen>
<para>配置文件被重新载入</para>
<screen>
This signal is called. [1]
This program is reload.
Array
(
[host] => 192.168.0.1
[port] => 3306
[user] => test
)
</screen>
<para>优雅重启完成。</para>
</section>
</section>
<section id="example">
<title>Example</title>
<screen>
<![CDATA[
<?php
/*
* PHP Daemon sample.
* Home: http://netkiller.github.io
* Author: netkiller<[email protected]>
*
*/
class Logger {
public function __construct(/*Logging $logger*/) {
}
public function logger($type, $message) {
$log = sprintf ( "%s\t%s\t%s\n", date ( 'Y-m-d H:i:s' ), $type, $message );
file_put_contents ( sprintf(__DIR__."/../log/sender.%s.log", date ( 'Y-m-d' )), $log, FILE_APPEND );
}
}
final class Signal{
public static $signo = 0;
protected static $ini = null;
public static function set($signo){
self::$signo = $signo;
}
public static function get(){
return(self::$signo);
}
public static function reset(){
self::$signo = 0;
}
}
class Test extends Logger {
//public static $signal = null;
public function __construct() {
//self::$signal == null;
}
public function run(){
while(true){
pcntl_signal_dispatch();
printf(".");
sleep(1);
if(Signal::get() == SIGHUP){
Signal::reset();
break;
}
}
printf("\n");
}
}
class Daemon extends Logger {
/* config */
const LISTEN = "tcp://192.168.2.15:5555";
const pidfile = __CLASS__;
const uid = 80;
const gid = 80;
const sleep = 5;
protected $pool = NULL;
protected $config = array();
public function __construct($uid, $gid, $class) {
$this->pidfile = '/var/run/'.basename(get_class($class), '.php').'.pid';
//$this->config = parse_ini_file('sender.ini', true); //include_once(__DIR__."/config.php");
$this->uid = $uid;
$this->gid = $gid;
$this->class = $class;
$this->classname = get_class($class);
$this->signal();
}
public function signal(){
pcntl_signal(SIGHUP, function($signo) /*use ()*/{
//echo "\n This signal is called. [$signo] \n";
printf("The process has been reload.\n");
Signal::set($signo);
});
}
private function daemon(){
if (file_exists($this->pidfile)) {
echo "The file $this->pidfile exists.\n";
exit();
}
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
//pcntl_wait($status); //Protect against Zombie children
exit($pid);
} else {
file_put_contents($this->pidfile, getmypid());
posix_setuid(self::uid);
posix_setgid(self::gid);
return(getmypid());
}
}
private function run(){
while(true){
printf("The process begin.\n");
$this->class->run();
printf("The process end.\n");
}
}
private function foreground(){
$this->run();
}
private function start(){
$pid = $this->daemon();
for(;;){
$this->run();
sleep(self::sleep);
}
}
private function stop(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
posix_kill($pid, 9);
unlink($this->pidfile);
}
}
private function reload(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
//posix_kill(posix_getpid(), SIGHUP);
posix_kill($pid, SIGHUP);
}
}
private function status(){
if (file_exists($this->pidfile)) {
$pid = file_get_contents($this->pidfile);
system(sprintf("ps ax | grep %s | grep -v grep", $pid));
}
}
private function help($proc){
printf("%s start | stop | restart | status | foreground | help \n", $proc);
}
public function main($argv){
if(count($argv) < 2){
$this->help($argv[0]);
printf("please input help parameter\n");
exit();
}
if($argv[1] === 'stop'){
$this->stop();
}else if($argv[1] === 'start'){
$this->start();
}else if($argv[1] === 'restart'){
$this->stop();
$this->start();
}else if($argv[1] === 'status'){
$this->status();
}else if($argv[1] === 'foreground'){
$this->foreground();
}else if($argv[1] === 'reload'){
$this->reload();
}else{
$this->help($argv[0]);
}
}
}
$daemon = new Daemon(80,80, new Test());
$daemon->main($argv);
?>
]]>
</screen>
</section>
<section id="proc">
<title>进程意外退出解决方案</title>
<para>如果是非常重要的进程,必须要保证程序正常运行,一旦出现任何异常退出,都需要做即时做处理。下面的程序可能检查进程是否异常退出,如果退出便立即启动。</para>
<screen>
<![CDATA[
#!/bin/sh
LOGFILE=/var/log/$(basename $0 .sh).log
PATTERN="my.php"
RECOVERY="/path/to/my.php start"
while true
do
TIMEPOINT=$(date -d "today" +"%Y-%m-%d_%H:%M:%S")
PROC=$(pgrep -o -f ${PATTERN})
#echo ${PROC}
if [ -z "${PROC}" ]; then
${RECOVERY} >> $LOGFILE
echo "[${TIMEPOINT}] ${PATTERN} ${RECOVERY}" >> $LOGFILE
#else
#echo "[${TIMEPOINT}] ${PATTERN} ${PROC}" >> $LOGFILE
fi
sleep 5
done &
]]>
</screen>
</section>
<section>
<title>延伸阅读</title>
<para><ulink url="http://netkiller.github.io/journal/php.mq.html">PHP高级编程之消息队列</ulink></para>
<para><ulink url="http://netkiller.github.io/journal/php.thread.html">PHP高级编程之多线程</ulink></para>
</section>
</article>