Class: DispatchPolicy::InflightTracker::ThreadSafeFlag

Inherits:
Object
  • Object
show all
Defined in:
lib/dispatch_policy/inflight_tracker.rb

Overview

Tiny fallback if concurrent-ruby isn’t available (it’s a Rails dep via active_support so it normally is).

Instance Method Summary collapse

Constructor Details

#initializeThreadSafeFlag

Returns a new instance of ThreadSafeFlag.



169
# File 'lib/dispatch_policy/inflight_tracker.rb', line 169

def initialize; @mutex = Mutex.new; @value = false; end

Instance Method Details

#make_trueObject



171
# File 'lib/dispatch_policy/inflight_tracker.rb', line 171

def make_true; @mutex.synchronize { @value = true }; end

#true?Boolean

Returns:

  • (Boolean)


170
# File 'lib/dispatch_policy/inflight_tracker.rb', line 170

def true?; @mutex.synchronize { @value }; end