Module: Lich::Common::ClientInputDispatcher

Defined in:
documented/common/client_input_dispatcher.rb

Overview

Serializes command processing across primary and detachable frontends.

Class Method Summary collapse

Class Method Details

.dispatch(client_string) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Serializes client command processing by synchronizing access with a mutex.

Yields the client string to a block within a synchronized context, ensuring that only one thread processes a command at a time. This prevents race conditions when multiple frontends (primary and detachable) attempt to dispatch commands concurrently.

Examples:

ClientInputDispatcher.dispatch("cast spell") { |cmd| process_command(cmd) }

Parameters:

  • client_string (String)

    the raw command string from the client



23
24
25
# File 'documented/common/client_input_dispatcher.rb', line 23

def self.dispatch(client_string)
  @mutex.synchronize { yield client_string }
end