PHPのすべらない話#3

2,229 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,229
On SlideShare
0
From Embeds
0
Number of Embeds
921
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PHPのすべらない話#3

  1. 1. <?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); } ?>
  2. 2. <?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 ?>

×