method

start_sharing

Importance_0
v5.0.0.1 - Show latest stable - 0 notes - Class: ShareLock
start_sharing() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/concurrency/share_lock.rb, line 80
      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
            @cv.wait_while { @exclusive_thread }
          else
            # This is an initial / outermost share call: any outstanding
            # requests for an exclusive lock get to go first
            @cv.wait_while { busy_for_sharing?(false) }
          end
          @sharing[Thread.current] += 1
        end
      end
Register or log in to add new notes.