Method: Win32::Daemon#state

Defined in:
lib/win32/daemon.rb

#stateObject

Returns the state of the service (as an constant integer) which can be any of the service status constants, e.g. RUNNING, PAUSED, etc.

This method is typically used within your service_main method to setup the loop. For example:

class MyDaemon < Daemon
  def service_main
    while state == RUNNING || state == PAUSED || state == IDLE
      # Your main loop here
    end
  end
end

See the Daemon#running? method for an abstraction of the above code.



343
344
345
# File 'lib/win32/daemon.rb', line 343

def state
  @@dwServiceState
end