Class Puppet::Parser::TypeLoader::Helper
In: lib/puppet/parser/type_loader.rb
Parent: Object

Helper class that makes sure we don‘t try to import the same file more than once from either the same thread or different threads.

Methods

do_once   new  

Included Modules

MonitorMixin

Public Class methods

Public Instance methods

Execute the supplied block exactly once per file, no matter how many threads have asked for it to run. If another thread is already executing it, wait for it to finish. If this thread is already executing it, return immediately without executing the block.

Note: the reason for returning immediately if this thread is already executing the block is to handle the case of a circular import—when this happens, we attempt to recursively re-parse a file that we are already in the process of parsing. To prevent an infinite regress we need to simply do nothing when the recursive import is attempted.

[Validate]