instance method start_sharing

Ruby on Rails 7.1.6

Since v5.2.8.1

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

start_sharing()

No documentation comment.

Source
# File activesupport/lib/active_support/concurrency/share_lock.rb, line 114
      def start_sharing
        synchronize do
          if @sharing[Thread.current] > 0 || @exclusive_thread == Thread.current
            # We already hold a lock; nothing to wait for
          elsif @waiting[Thread.current]
            # We're nested inside a +yield_shares+ call: we'll resume as
            # soon as there isn't an exclusive lock in our way
            wait_for(:start_sharing) { @exclusive_thread }
          else
            # This is an initial / outermost share call: any outstanding
            # requests for an exclusive lock get to go first
            wait_for(:start_sharing) { busy_for_sharing?(false) }
          end
          @sharing[Thread.current] += 1
        end
      end

Defined in activesupport/lib/active_support/concurrency/share_lock.rb line 114 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Concurrency::ShareLock

Type at least 2 characters to search.

↑↓ navigate · open · esc close