⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (813 Bytes)
Feature #8128
» example-take-all.rb
vjoel (Joel VanderWerf)
, 03/20/2013 08:00 AM
$LOAD_PATH
.
unshift
"lib"
require
'rinda/rinda'
require
'rinda/take-all'
rd
,
wr
=
IO
.
pipe
server
=
fork
do
rd
.
close
require
'rinda/tuplespace'
ts
=
Rinda
::
TupleSpace
.
new
ts
.
extend
Rinda
::
TupleSpace
::
TakeAll
DRb
.
start_service
(
nil
,
ts
)
wr
.
puts
DRb
.
uri
DRb
.
thread
.
join
end
wr
.
close
uri
=
rd
.
gets
.
chomp
c1
=
fork
do
DRb
.
start_service
ts
=
Rinda
::
TupleSpaceProxy
.
new
(
DRbObject
.
new_with_uri
(
uri
))
ts
.
extend
Rinda
::
TupleSpaceProxy
::
TakeAll
puts
"read_all:"
p
ts
.
read_all
[
1
,
2
,
nil
]
puts
"take_all:"
p
ts
.
take_all
[
1
,
2
,
nil
]
puts
"write..."
ts
.
write
[
1
,
2
,
3
]
ts
.
write
[
1
,
2
,
4
]
ts
.
write
[
1
,
2
,
5
]
puts
"read_all:"
p
ts
.
read_all
[
1
,
2
,
nil
]
puts
"take_all:"
p
ts
.
take_all
[
1
,
2
,
nil
]
puts
"read_all:"
p
ts
.
read_all
[
1
,
2
,
nil
]
end
Process
.
wait
c1
Process
.
kill
"TERM"
,
server
« Previous
1
2
3
4
5
Next »
(4-4/5)
Loading...