From 97c9032bc32b49b6e9f5272c5c60a0eb65fc0a3d Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Wed, 4 Sep 2019 14:02:13 -0400 Subject: [PATCH 1/3] Have threading functions (lock, unlock, ...) throw Error for old Base.Condition --- base/condition.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/base/condition.jl b/base/condition.jl index 333075b7bfd6d..e821e20724c42 100644 --- a/base/condition.jl +++ b/base/condition.jl @@ -162,3 +162,8 @@ this, and can be used for level-triggered events. This object is NOT thread-safe. See [`Threads.Condition`](@ref) for a thread-safe version. """ const Condition = GenericCondition{AlwaysLockedST} + +lock(c::GenericCondition{AlwaysLockedST}) = + throw(ArgumentError("`Condition` is NOT thread-safe. Please use `Threads.Condition` instead for concurrent code.")) +unlock(c::GenericCondition{AlwaysLockedST}) = + throw(ArgumentError("`Condition` is NOT thread-safe. Please use `Threads.Condition` instead for concurrent code.")) From 39387ff775deb68c3aaa3ee625516753a1878730 Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Wed, 11 Sep 2019 17:54:47 -0400 Subject: [PATCH 2/3] Update base/condition.jl error string: concurrent -> multi-threaded Co-Authored-By: Jeff Bezanson --- base/condition.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/condition.jl b/base/condition.jl index e821e20724c42..95edae2c6592b 100644 --- a/base/condition.jl +++ b/base/condition.jl @@ -164,6 +164,6 @@ This object is NOT thread-safe. See [`Threads.Condition`](@ref) for a thread-saf const Condition = GenericCondition{AlwaysLockedST} lock(c::GenericCondition{AlwaysLockedST}) = - throw(ArgumentError("`Condition` is NOT thread-safe. Please use `Threads.Condition` instead for concurrent code.")) + throw(ArgumentError("`Condition` is not thread-safe. Please use `Threads.Condition` instead for multi-threaded code.")) unlock(c::GenericCondition{AlwaysLockedST}) = throw(ArgumentError("`Condition` is NOT thread-safe. Please use `Threads.Condition` instead for concurrent code.")) From b5b99623e53e68c3f050a5c72d5aac5af5a3956e Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Wed, 11 Sep 2019 17:56:42 -0400 Subject: [PATCH 3/3] Update Condition error string for unlock --- base/condition.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/condition.jl b/base/condition.jl index 95edae2c6592b..6a82a10799566 100644 --- a/base/condition.jl +++ b/base/condition.jl @@ -166,4 +166,4 @@ const Condition = GenericCondition{AlwaysLockedST} lock(c::GenericCondition{AlwaysLockedST}) = throw(ArgumentError("`Condition` is not thread-safe. Please use `Threads.Condition` instead for multi-threaded code.")) unlock(c::GenericCondition{AlwaysLockedST}) = - throw(ArgumentError("`Condition` is NOT thread-safe. Please use `Threads.Condition` instead for concurrent code.")) + throw(ArgumentError("`Condition` is not thread-safe. Please use `Threads.Condition` instead for multi-threaded code."))