Reconfiguring or Disconnecting a Task


As a task works with the event broker, it may want to reconfigure itself to monitor different event types, change its focus dependence, reset the size of its event queue, or use a new reply port for event broker messages. Or it may want to completely disconnect itself from the event broker so that it no longer monitors events. In each case, the task sends a new configuration message to the event broker.

Reconfiguring the Event Broker Connection

The task initializes a new ConfigurationRequest structure with the new settings it wants. It then sends an EB_Configure message to the event broker to have the new settings take effect. The event broker uses the reply port of the EB_Configure message to determine which tasks are connected to the event broker. When changing the configuration, the application should use the same reply port for the message as it did when it first connected to the event broker.

If a task wants to change the reply port it uses to receive event broker messages, it must first disconnect from the event broker using a configuration message with its old reply port. Then the task must create a new configuration message with a new reply port, and send the new configuration message to the event broker. The task must also close the old configuration message and old reply port.

Disconnecting From the Event Broker

If the task wishes to disconnect itself completely from the event broker, it sends a configuration request, using its current reply port, and specifies a 0 for both the trigger and capture masks. The event broker then disconnects the task. A task can also call DeleteMsgPort() on its current reply port. On the next tick, the event broker will disconnect the task.