Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions spec/std/thread/condition_variable_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pending_interpreted describe: Thread::ConditionVariable do
cond = Thread::ConditionVariable.new

mutex.synchronize do
new_thread do
Thread.new do
mutex.synchronize { cond.signal }
end

Expand All @@ -23,7 +23,7 @@ pending_interpreted describe: Thread::ConditionVariable do
waiting = 0

5.times do
new_thread do
Thread.new do
mutex.synchronize do
waiting += 1
cv1.wait(mutex)
Expand Down Expand Up @@ -79,7 +79,7 @@ pending_interpreted describe: Thread::ConditionVariable do
cond = Thread::ConditionVariable.new

mutex.synchronize do
new_thread do
Thread.new do
mutex.synchronize { cond.signal }
end

Expand Down
6 changes: 3 additions & 3 deletions spec/std/thread/mutex_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pending_interpreted describe: Thread::Mutex do
mutex = Thread::Mutex.new

threads = Array.new(10) do
new_thread do
Thread.new do
mutex.synchronize { a += 1 }
end
end
Expand All @@ -23,15 +23,15 @@ pending_interpreted describe: Thread::Mutex do
mutex.try_lock.should be_false
expect_raises(RuntimeError) { mutex.lock }
mutex.unlock
new_thread { mutex.synchronize { } }.join
Thread.new { mutex.synchronize { } }.join
end

it "won't unlock from another thread" do
mutex = Thread::Mutex.new
mutex.lock

expect_raises(RuntimeError) do
new_thread { mutex.unlock }.join
Thread.new { mutex.unlock }.join
end

mutex.unlock
Expand Down
10 changes: 5 additions & 5 deletions spec/std/thread_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ require "../support/thread"
pending_interpreted describe: Thread do
it "allows passing an argumentless fun to execute" do
a = 0
thread = new_thread { a = 1; 10 }
thread = Thread.new { a = 1; 10 }
thread.join
a.should eq(1)
end

it "raises inside thread and gets it on join" do
thread = new_thread { raise "OH NO" }
thread = Thread.new { raise "OH NO" }
expect_raises Exception, "OH NO" do
thread.join
end
end

it "returns current thread object" do
current = nil
thread = new_thread { current = Thread.current }
thread = Thread.new { current = Thread.current }
thread.join
current.should be(thread)
current.should_not be(Thread.current)
Expand All @@ -32,7 +32,7 @@ pending_interpreted describe: Thread do
it "yields the processor" do
done = false

thread = new_thread do
thread = Thread.new do
3.times { Thread.yield }
done = true
end
Expand All @@ -52,7 +52,7 @@ pending_interpreted describe: Thread do
{% end %}

name = nil
thread = new_thread(name: "some-name") do
thread = Thread.new(name: "some-name") do
name = Thread.current.name
end
thread.name.should eq("some-name")
Expand Down
Loading