Method: Vagrant::Util::Busy.register

Defined in:
lib/vagrant/util/busy.rb

.register(sig_callback) ⇒ Object

Registers a SIGINT handler. This typically is called from busy. Callbacks are only registered once, so calling this multiple times with the same callback has no consequence.



27
28
29
30
31
32
33
34
35
# File 'lib/vagrant/util/busy.rb', line 27

def register(sig_callback)
  @@mutex.synchronize do
    registered << sig_callback
    registered.uniq!

    # Register the handler if this is our first callback.
    Signal.trap("INT") { fire_callbacks } if registered.length == 1
  end
end