pips_event_register_handler()

Updated: May 06, 2022

Register a handler for the specified event type and provider

Synopsis:

#include <pips/event.h>
int pips_event_register_handler(const pips_event_type_e type,
                                pips_provider_t *const provider_handle,
                                pips_event_handler_t const handler,
                                void *user_data)

Arguments:

type
A flag indicating the event type for which a handler is being registered
provider_handle
A pointer to the provider for which the event handler is being registered
handler
A pointer to the callback to invoke in response to an event of the specified type
user_data
A pointer to a user data buffer that will be passed to the callback when the associated event is received

Library:

pips-client

Description:

This function registers a handler with the PiPS framework to ensure that the handler (callback) is invoked in response to the specified event type for the specified provider. Any number of callbacks can be registered to handle a particular event type. However, the same callback cannot be registered multiple times in a single thread for the same provider and user data combination.

Returns:

EOK
The handler was successfully registered
-1
An error occurred while registering the handler (errno is set)

Errors:

  • ENODEV: The provider handle is invalid.
  • ENOTTY: The given event type is not supported.
  • EALREADY: The handler has already been registered with the provider.