E5ED StreamSelectLoop: Fix erroneous zero-time sleep (2) by ivkalita · Pull Request #93 · reactphp/event-loop · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add StreamSelectLoop timeout rounding.
  • Loading branch information
ivkalita committed Apr 3, 2017
commit 09cd0bcb4038dea3e84283984a011fc2c32285f0
6 changes: 5 additions & 1 deletion src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ public function run()
if ($timeout < 0) {
$timeout = 0;
} else {
$timeout *= self::MICROSECONDS_PER_SECOND;
/*
* round() needed to correct float error:
* https://github.com/reactphp/event-loop/issues/48
*/
$timeout = round($timeout * self::MICROSECONDS_PER_SECOND);
}

// The only possible event is stream activity, so wait forever ...
Expand Down
0