ifuture 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -1
- data/ifuture.gemspec +1 -1
- data/lib/ifuture/version.rb +1 -1
- data/lib/ifuture.rb +5 -7
- metadata +3 -3
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# ifuture
|
2
2
|
|
3
|
-
An implementation of Futures
|
3
|
+
An implementation of Futures for Ruby using process forks with IChannel.
|
4
|
+
|
5
|
+
The Future starts running right away, but isn't blocking because it runs in its own Process fork. If we wait until the Future is ready before asking for its value, the value will be returned right away. If we ask early, it blocks until delivery.
|
4
6
|
|
5
7
|
## Usage
|
6
8
|
|
data/ifuture.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'ifuture/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = 'ifuture'
|
8
8
|
gem.version = IFuture::VERSION
|
9
|
-
gem.authors = ['
|
9
|
+
gem.authors = ['Shannon Skipper']
|
10
10
|
gem.email = ['shannonskipper@gmail.com']
|
11
11
|
gem.description = %q{Futures Implemented on Fork}
|
12
12
|
gem.summary = %q{Futures implemented on top of IChannel for easy Forking.}
|
data/lib/ifuture/version.rb
CHANGED
data/lib/ifuture.rb
CHANGED
@@ -2,8 +2,8 @@ require 'ifuture/version'
|
|
2
2
|
require 'ichannel'
|
3
3
|
|
4
4
|
class IFuture
|
5
|
-
def initialize &block
|
6
|
-
@channel = IChannel.new
|
5
|
+
def initialize serializer = Marshal, &block
|
6
|
+
@channel = IChannel.new serializer
|
7
7
|
|
8
8
|
@pid = fork do
|
9
9
|
@channel.put block.call
|
@@ -11,11 +11,9 @@ class IFuture
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def ready?
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
true
|
18
|
-
end
|
14
|
+
!Process.getpgid @pid
|
15
|
+
rescue Errno::ESRCH
|
16
|
+
true
|
19
17
|
end
|
20
18
|
|
21
19
|
def value
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ifuture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Shannon Skipper
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ichannel
|