SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
<?php
function sub($i, $ch) {
    for (;;) {
        $a = <- [$ch];
        printf("%d:%dn", $i, $a);
    }
}

$ch = thread_message_queue_create();
for ($i = 0; $i < 10; $i++) {
    thread_create('sub', $i, $ch);
}
$i = 0;
for (;;) {
    [$ch] <- ($i++);
    usleep(50000);
}
?>
<?php
function sub($i, $ch) { $ch
     for (;;) {
         $a = <- [$ch];
         printf("%d:%dn", $i, $a);
  $ch}
}

$ch = thread_message_queue_create();
for ($i = 0; $i < 10; $i++) {
    thread_create('sub', $i, $ch);
                                 $ch

}
$i = 0;
for (;;) {
    [$ch] <- ($i++);
    usleep(50000);
}               $ch

?>
PHPのすべらない話#3

Contenu connexe

Tendances

Introduction to Service Worker
Introduction to Service WorkerIntroduction to Service Worker
Introduction to Service WorkerShogo Sensui
 
Sources
SourcesSources
Sourcesyonsei
 
Javascript and jQuery for Mobile
Javascript and jQuery for MobileJavascript and jQuery for Mobile
Javascript and jQuery for MobileIvano Malavolta
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins IntroCasey West
 
Formulario
FormularioFormulario
Formulariotukisele
 
Slides
SlidesSlides
Slidesvti
 
Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...
Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...
Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...INSTITUTO GENS
 
How to update tally statutory kalpataru
How to update tally statutory kalpataruHow to update tally statutory kalpataru
How to update tally statutory kalpataruSwati
 
Php & mysql
Php & mysqlPhp & mysql
Php & mysqlola98z
 
6 al-iman-bil-kutub
6 al-iman-bil-kutub6 al-iman-bil-kutub
6 al-iman-bil-kutublargono drs
 
Working With Ajax Frameworks
Working With Ajax FrameworksWorking With Ajax Frameworks
Working With Ajax FrameworksJonathan Snook
 
การบันทึกและออกจากโปรแกรมMspowerpoint
การบันทึกและออกจากโปรแกรมMspowerpointการบันทึกและออกจากโปรแกรมMspowerpoint
การบันทึกและออกจากโปรแกรมMspowerpointเทวัญ ภูพานทอง
 
Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Suissa
 

Tendances (20)

Introduction to Service Worker
Introduction to Service WorkerIntroduction to Service Worker
Introduction to Service Worker
 
Sources
SourcesSources
Sources
 
Phpex3
Phpex3Phpex3
Phpex3
 
Javascript and jQuery for Mobile
Javascript and jQuery for MobileJavascript and jQuery for Mobile
Javascript and jQuery for Mobile
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins Intro
 
Formulario
FormularioFormulario
Formulario
 
jQuery PLUGIN
jQuery PLUGINjQuery PLUGIN
jQuery PLUGIN
 
Slides
SlidesSlides
Slides
 
Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...
Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...
Consumo de Mídia Televisa - da produção à leitura crítica dos meios de comuni...
 
Programas for
Programas forProgramas for
Programas for
 
Секреты WP_Query
Секреты WP_QueryСекреты WP_Query
Секреты WP_Query
 
How to update tally statutory kalpataru
How to update tally statutory kalpataruHow to update tally statutory kalpataru
How to update tally statutory kalpataru
 
Php & mysql
Php & mysqlPhp & mysql
Php & mysql
 
6 al-iman-bil-kutub
6 al-iman-bil-kutub6 al-iman-bil-kutub
6 al-iman-bil-kutub
 
Working With Ajax Frameworks
Working With Ajax FrameworksWorking With Ajax Frameworks
Working With Ajax Frameworks
 
การบันทึกและออกจากโปรแกรมMspowerpoint
การบันทึกและออกจากโปรแกรมMspowerpointการบันทึกและออกจากโปรแกรมMspowerpoint
การบันทึกและออกจากโปรแกรมMspowerpoint
 
SmartCSS
SmartCSSSmartCSS
SmartCSS
 
Jquery2
Jquery2Jquery2
Jquery2
 
Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio
 
Introducción a Bolt
Introducción a BoltIntroducción a Bolt
Introducción a Bolt
 

En vedette

Goをカンストさせる話
Goをカンストさせる話Goをカンストさせる話
Goをカンストさせる話Moriyoshi Koizumi
 
Authentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and PyramidAuthentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and PyramidMoriyoshi Koizumi
 
Pyramidのrendererをカスタマイズする
PyramidのrendererをカスタマイズするPyramidのrendererをカスタマイズする
PyramidのrendererをカスタマイズするMoriyoshi Koizumi
 
LLの虎 semifinal: 殺伐Python
LLの虎 semifinal: 殺伐PythonLLの虎 semifinal: 殺伐Python
LLの虎 semifinal: 殺伐PythonMoriyoshi Koizumi
 
HLSについて知っていることを話します
HLSについて知っていることを話しますHLSについて知っていることを話します
HLSについて知っていることを話しますMoriyoshi Koizumi
 

En vedette (11)

PHPのすべらない話
PHPのすべらない話PHPのすべらない話
PHPのすべらない話
 
PHP7を魔改造した話
PHP7を魔改造した話PHP7を魔改造した話
PHP7を魔改造した話
 
Goをカンストさせる話
Goをカンストさせる話Goをカンストさせる話
Goをカンストさせる話
 
Authentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and PyramidAuthentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and Pyramid
 
Pyramidのrendererをカスタマイズする
PyramidのrendererをカスタマイズするPyramidのrendererをカスタマイズする
Pyramidのrendererをカスタマイズする
 
GoでKVSを書けるのか
GoでKVSを書けるのかGoでKVSを書けるのか
GoでKVSを書けるのか
 
Pyfes201110
Pyfes201110Pyfes201110
Pyfes201110
 
Introducing E-Cell 3.2
Introducing E-Cell 3.2Introducing E-Cell 3.2
Introducing E-Cell 3.2
 
LLの虎 semifinal: 殺伐Python
LLの虎 semifinal: 殺伐PythonLLの虎 semifinal: 殺伐Python
LLの虎 semifinal: 殺伐Python
 
PHPにおけるI/O多重化とyield
PHPにおけるI/O多重化とyieldPHPにおけるI/O多重化とyield
PHPにおけるI/O多重化とyield
 
HLSについて知っていることを話します
HLSについて知っていることを話しますHLSについて知っていることを話します
HLSについて知っていることを話します
 

Plus de Moriyoshi Koizumi

All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnMoriyoshi Koizumi
 
よいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれたよいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれたMoriyoshi Koizumi
 
mod_himoteからはじめよう
mod_himoteからはじめようmod_himoteからはじめよう
mod_himoteからはじめようMoriyoshi Koizumi
 
HPHPは約束の地なのか
HPHPは約束の地なのかHPHPは約束の地なのか
HPHPは約束の地なのかMoriyoshi Koizumi
 
Phjosh(仮)プロジェクト
Phjosh(仮)プロジェクトPhjosh(仮)プロジェクト
Phjosh(仮)プロジェクトMoriyoshi Koizumi
 
10〜30分で何となく分かるGo
10〜30分で何となく分かるGo10〜30分で何となく分かるGo
10〜30分で何となく分かるGoMoriyoshi Koizumi
 
Phpをいじり倒す10の方法
Phpをいじり倒す10の方法Phpをいじり倒す10の方法
Phpをいじり倒す10の方法Moriyoshi Koizumi
 
X / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural OverviewX / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural OverviewMoriyoshi Koizumi
 

Plus de Moriyoshi Koizumi (18)

All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 Autumn
 
Uguisudani
UguisudaniUguisudani
Uguisudani
 
よいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれたよいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれた
 
Ik in action
Ik in actionIk in action
Ik in action
 
Nginx lua
Nginx luaNginx lua
Nginx lua
 
Haxeについて
HaxeについてHaxeについて
Haxeについて
 
Gocon2013
Gocon2013Gocon2013
Gocon2013
 
PHP language update 201211
PHP language update 201211PHP language update 201211
PHP language update 201211
 
mod_himoteからはじめよう
mod_himoteからはじめようmod_himoteからはじめよう
mod_himoteからはじめよう
 
HPHPは約束の地なのか
HPHPは約束の地なのかHPHPは約束の地なのか
HPHPは約束の地なのか
 
Phjosh(仮)プロジェクト
Phjosh(仮)プロジェクトPhjosh(仮)プロジェクト
Phjosh(仮)プロジェクト
 
Aaなゲームをjsで
AaなゲームをjsでAaなゲームをjsで
Aaなゲームをjsで
 
Aaなゲームをjsで
AaなゲームをjsでAaなゲームをjsで
Aaなゲームをjsで
 
ctypes拡張モジュール
ctypes拡張モジュールctypes拡張モジュール
ctypes拡張モジュール
 
10〜30分で何となく分かるGo
10〜30分で何となく分かるGo10〜30分で何となく分かるGo
10〜30分で何となく分かるGo
 
Phpをいじり倒す10の方法
Phpをいじり倒す10の方法Phpをいじり倒す10の方法
Phpをいじり倒す10の方法
 
X / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural OverviewX / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural Overview
 

PHPのすべらない話#3

  • 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. <?php function sub($i, $ch) { for (;;) { $a = <- [$ch]; printf("%d:%dn", $i, $a); } } $ch = thread_message_queue_create(); for ($i = 0; $i < 10; $i++) { thread_create('sub', $i, $ch); } $i = 0; for (;;) { [$ch] <- ($i++); usleep(50000); } ?>
  • 26. <?php function sub($i, $ch) { $ch for (;;) { $a = <- [$ch]; printf("%d:%dn", $i, $a); $ch} } $ch = thread_message_queue_create(); for ($i = 0; $i < 10; $i++) { thread_create('sub', $i, $ch); $ch } $i = 0; for (;;) { [$ch] <- ($i++); usleep(50000); } $ch ?>