summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNathan Williams <nathan@teamtreehouse.com>2016-03-10 18:22:05 -0800
committerNathan Williams <nath.e.will@gmail.com>2016-03-10 20:54:52 -0800
commitc7964c2ab56bc5c00e86deb01cb4be35e5d6feb3 (patch)
tree2a14a056cf6fed1a2b27055ffc674d9000e36a56 /lib
parent615f2889ac732ac8435f69f8c9dfdae6f778edb6 (diff)
downloadchef-c7964c2ab56bc5c00e86deb01cb4be35e5d6feb3.tar.gz
fix deprecated Thread.exclusive with Mutex
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/dsl/declare_resource.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/dsl/declare_resource.rb b/lib/chef/dsl/declare_resource.rb
index 9a59859d5a..868c5e7ed9 100644
--- a/lib/chef/dsl/declare_resource.rb
+++ b/lib/chef/dsl/declare_resource.rb
@@ -22,6 +22,7 @@ require "chef/exceptions"
class Chef
module DSL
module DeclareResource
+ BUILD_RESOURCE_SEMAPHORE = Mutex.new
#
# Instantiates a resource (via #build_resource), then adds it to the
@@ -88,7 +89,7 @@ class Chef
#
def build_resource(type, name, created_at = nil, run_context: self.run_context, &resource_attrs_block)
created_at ||= caller[0]
- Thread.exclusive do
+ BUILD_RESOURCE_SEMAPHORE.synchronize do
require "chef/resource_builder" unless defined?(Chef::ResourceBuilder)
end