Method: Corosync::Votequorum#dispatch

Defined in:
lib/corosync/votequorum.rb

#dispatch(timeout = -1)) ⇒ Boolean

Checks for a single pending event and triggers the appropriate callback if found.

Parameters:

  • timeout (Integer) (defaults to: -1))

    How long to wait for an event.

    • -1: Indefinite. Wait forever

    • 0: Non-blocking. If there isn’t a pending event, return immediately

    • >0: Wait the specified number of seconds.

Returns:

  • (Boolean)

    Returns True if an event was triggered. Otherwise False.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/corosync/votequorum.rb', line 101

def dispatch(timeout = -1)
	if !timeout != 0 then
		timeout = nil if timeout == -1
		select([@fd], [], [], timeout)
	end

	begin
		Corosync.cs_send(:votequorum_dispatch, @handle, Corosync::CS_DISPATCH_ONE_NONBLOCKING)
	rescue Corosync::TryAgainError
		return false
	end

	return true
end