Sha256: 5fcef1b422b6b4d21f42b676a6383b017556c069c15ae242f3023e885cf0af83
Contents?: true
Size: 794 Bytes
Versions: 7
Compression:
Stored size: 794 Bytes
Contents
# frozen_string_literal: true module Datadog module Core # Semaphore pattern implementation, as described in documentation for # ConditionVariable. # # @api private class Semaphore def initialize @wake_lock = Mutex.new @wake = ConditionVariable.new end def signal wake_lock.synchronize do wake.signal end end def wait(timeout = nil) wake_lock.synchronize do # steep specifies that the second argument to wait is of type # ::Time::_Timeout which for some reason is not Numeric and is not # castable from Numeric. wake.wait(wake_lock, timeout) # steep:ignore end end private attr_reader :wake_lock, :wake end end end
Version data entries
7 entries across 7 versions & 1 rubygems