forked from larrytheliquid/dataflow
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Larry Diehl
committed
Aug 29, 2009
1 parent
fcbd2f3
commit c07becd
Showing
2 changed files
with
36 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require "#{File.dirname(__FILE__)}/spec_helper" | ||
|
||
describe 'A barrier' do | ||
it 'waits for variables to be bound before continuing' do | ||
local do |x, y, barrier_broken| | ||
Thread.new do | ||
barrier x, y | ||
unify barrier_broken, true | ||
end | ||
Thread.new { unify x, :x } | ||
Thread.new { unify y, :y } | ||
barrier_broken.should be_true | ||
end | ||
end | ||
|
||
it 'continues for variables that are already bound' do | ||
local do |x, y, barrier_broken| | ||
unify x, :x | ||
unify y, :y | ||
barrier x, y | ||
unify barrier_broken, true | ||
barrier_broken.should be_true | ||
end | ||
end | ||
end |