Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pushed to version 0.0.2, major changes:
- Switched to testy for testing - More tests! - Fixed an issue on RedHat/CentOS machines where select() did not return an expected array from forkify - Another example illustrating the drawback of non-pool forking
- Loading branch information
Showing
8 changed files
with
86 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ lib/forkify.rb | |
test/test_forkify.rb | ||
examples/a.rb | ||
examples/b.rb | ||
examples/c.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
|
||
== REQUIREMENTS: | ||
|
||
* None | ||
* Testy - only for running the tests | ||
|
||
== INSTALL: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env ruby | ||
# vim: set ts=2 sw=2 filetype=Ruby | ||
# | ||
# This example shows a problem with the current implementation of forkify: | ||
# if a fork finishes work, it will still wait for the other forks to finish | ||
# in the process pool before forking new processes for work. | ||
# | ||
# I hope to remedy this as soon as I figure out a good solution for it. | ||
|
||
require 'forkify' | ||
|
||
[1, 1, 1, 1, 5, 1].forkify(5) { |n| puts n; sleep(n); n } | ||
|
||
# 0.04s user 0.06s system 1% cpu 6.031 total | ||
# (would be possible to run in a little over 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters