Method: CLI::UI::Spinner::SpinGroup#stop

Defined in:
lib/cli/ui/spinner/spin_group.rb

#stopObject

: -> void



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/cli/ui/spinner/spin_group.rb', line 324

def stop
  # If we already own the mutex (called from within another synchronized block),
  # set stopped directly to avoid deadlock
  if @m.owned?
    return if @stopped

    @stopped = true
  else
    @m.synchronize do
      return if @stopped

      @stopped = true
    end
  end
  # Interrupt is thread-safe on its own, so we can call it outside the mutex
  @work_queue.interrupt
end