mtcp_raise_event − raise a child event for a multi-event filter


#include <mos_api.h>

int mtcp_raise_event(mctx_t mctx, event_t child_event);


mtcp_raise_event() raises a child event child_event , in turn, the callback functions and the filter functions registered to the child event will be triggered.

The child_event should be a event that is allocated via mtcp_alloc_event () or user-defined events which is created via mtcp_define_event () are triggered automatically by mOS core based on its condition, and those events are not allowed to be triggered by mtcp_alloc_event ()

This function is designed to be called inside event-filter functions, so that a single filter can trigger a set of multiple child events based on the processing result inside the filter function.

For example, a filter function can be a string-pattern matching function that finds for multiple possible patterns. According to the pattern-matching result, it can trigger multiple child events that corresponds to each pattern. In this case, mtcp_raise_event() can be called multiple times inside the filter function for each pattern found in the given string.


Returns 0 on success. When the given child_event parameter points to any event that is undefined or invalid (not the one created via mtcp_alloc_event() ), it fails and returns -1.


mOS development team <>


mtcp_alloc_event(), mtcp_define_event()


This page is part of mOS release 0.3 docs section. A description of the project, and information about reporting bugs, can be found at