From 46024b4116c46960cf39fe785328afd103befa49 Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Thu, 2 Jan 2020 11:46:49 -0300 Subject: [PATCH] Fix mutex specs race condition on mt --- spec/std/mutex_spec.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/std/mutex_spec.cr b/spec/std/mutex_spec.cr index 2dda81d7ef6f..8ff989e8ba46 100644 --- a/spec/std/mutex_spec.cr +++ b/spec/std/mutex_spec.cr @@ -46,13 +46,15 @@ describe Mutex do it "can't be unlocked by another fiber" do mutex = nil + done = false spawn do mutex = Mutex.new mutex.not_nil!.lock + done = true end - until mutex + until done Fiber.yield end @@ -80,13 +82,15 @@ describe Mutex do it "can't be unlocked by another fiber" do mutex = nil + done = false spawn do mutex = Mutex.new(:reentrant) mutex.not_nil!.lock + done = true end - until mutex + until done Fiber.yield end