More Related Content
PDF
ドメイン駆動設計のための Spring の上手な使い方増田 亨
PDF
ドメイン駆動設計に15年取り組んでわかったこと増田 亨
PDF
怖くないSpring Bootのオートコンフィグレーション土岐 孝平
What's hot (20)
PDF
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところY Watanabe
PDF
ドメイン駆動設計サンプルコードの徹底解説増田 亨
PDF
ドメインオブジェクトの見つけ方・作り方・育て方増田 亨
PDF
Mercari JPのモノリスサービスをKubernetesに移行した話 PHP Conference 2022 9/24Shin Ohno
Similar to イベント駆動プログラミングとI/O多重化 (20)
More from Gosuke Miyashita (20)
PPT
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
イベント駆動プログラミングとI/O多重化
- 34. I/Oイベント登
録
I/Oイベント待
ち
I/Oイベント処
理
後処理
- 37. int sock = socket(PF_INET, SOCK_STREAM);
bind(sock, addr);
listen(sock);
while ( 1 ) {
int new_sock = accept(sock, &addr);
char buf[100];
size_t size = read(new_sock, buf, 100);
if ( size == 0 ) {
close(new_sock);
}
else {
write(new_sock, buf, size);
}
}
- 41. クライアント
accept(sock)
待ち受けソケット 接続ソケット
(イベント監視対象) サーバ
(イベント監視
対象につっこ
む)
- 48. select
poll
epoll
kqueue
/dev/poll
- 70. var req_to_zenrin = http.request(
options,
function(res2) {
res2.on('end', function() {
res.end();
});
res2.on('data', function(chunk) {
res.write(chunk);
});
}
);
- 71. var referer;
sdb.getItem(
'gha',
host,
function( error, result ) {
if ( result ) {
referer = ‘http://hoge.com/’;
}
}
);
// sdb.getItem()終了前に次の処理
- 72. sdb.getItem(
'gha',
host,
function( error, result ) {
if ( result ) {
access_to_zenrin('http://hoge.com');
}
else {
access_to_zenrin();
}
}
);