ec_message_enqueue

March 26, 2020 Contributors

Name

ec_message_enqueue — This hook is called whenever a message is passed to the ec_message_enqueue API

Synopsis

#include "hooks/core/ec_message_enqueue.h"

| int **core_ec_message_enqueue** ( | closure, |   |
|   | msg, |   |
|   | now); |   |

void * <var class="pdparam">closure</var>;
ec_message * <var class="pdparam">msg</var>;
struct timeval * <var class="pdparam">now</var>;

Description

This hook is called whenever a message is passed to the ec_message_enqueue API.

Parameters

closure

A pointer to the closure function.

msg

An ec_message. For documentation of this data structure see “ec_message”

now

A timeval struct.

Return Values

If you return EC_MESSAGE_ENQUEUE_HOOK_CONT, then the next hook in the chain is called. If EC_MESSAGE_ENQUEUE_HOOK_CONT is the return value of the last hook in the chain, then the default ec_message_enqueue action will be taken.

If you return EC_MESSAGE_ENQUEUE_HOOK_OK, then subsequent hooks and the default core behavior are skipped, and ec_message_enqueue will return and indicate success to its caller. By returning this value, the hook is taking ownership of the message and it has responsibility for cleaning up or otherwise dealing with the message.

If you return EC_MESSAGE_ENQUEUE_HOOK_ERR, then subsequent hooks and the default core behavior are skipped, and ec_message_enqueue will return and indicate failure to its caller. By returning this value, the hook is taking ownership of the message and it has responsibility for cleaning up or otherwise dealing with the message.

Threading

This hook will be called in the Scheduler thread.