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.



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

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

Instance Method Details

#make_trueObject



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

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

#true?Boolean

Returns:

  • (Boolean)


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

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