Sha256: 12bfa68ea0ea0e8aad78f8d787189bac534187427e9be3975fd4db6f00973f2b
Contents?: true
Size: 691 Bytes
Versions: 7
Compression:
Stored size: 691 Bytes
Contents
module Innate begin require 'innate/state/fiber' STATE = State::Fiber.new rescue LoadError require 'innate/state/thread' STATE = State::Thread.new end module SingletonMethods # Use this method to achieve thread-safety for sensitive operations. # # This should be of most use when manipulating files to prevent other # threads from doing the same, no other code will be scheduled during # execution of this method. # # @param [Proc] block the things you want to execute # @see State::Thread#sync State::Fiber#sync def sync(&block) STATE.sync(&block) end def defer(&block) STATE.defer(&block) end end end
Version data entries
7 entries across 7 versions & 2 rubygems