EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
event_machine_eo.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015-2025, Nokia Solutions and Networks
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef EVENT_MACHINE_EO_H_
32#define EVENT_MACHINE_EO_H_
33
34#pragma GCC visibility push(default)
35
36/**
37 * @file
38 * @defgroup em_eo Execution objects (EO)
39 *
40 * Operations on EOs
41 *
42 * Execution objects (EO) are the application building blocks of EM.
43 * An EO typically implements one logical function or one stage in a pipeline,
44 * but alternatively the whole application could be implemented with one EO.
45 * EOs work as servers, queues are the service access points (inputs to the EO).
46 *
47 * An EO consists of user provided callback functions and context data.
48 * The most important function is the receive function, which gets called
49 * when an event is received from one of the queues associated with the EO.
50 * The EM scheduler selects the next event for processing on a core and the
51 * EM dispatcher on that core maps the received event and queue information to
52 * an EO receive function to call to process the event.
53 * Other EO functions are used to manage start-up and teardown of EOs. See
54 * individual EO functions for more details.
55 *
56 * em_eo_create()
57 * |
58 * v
59 * .-------------.
60 * .->.------->| CREATED | new events discarded
61 * | | '-------------'
62 * | | | em_eo_start(+notifs) / em_eo_start_sync()
63 * | | v
64 * | | .-------------.
65 * | | | STARTING | new events discarded
66 * | ' '-------------'
67 * | \ global start
68 * | \ THEN
69 * | \ local start on each core
70 * | '--- FAIL OK
71 * | | send 'start-completed' notifications
72 * | v
73 * . .-------------.
74 * | | RUNNING | events processed by the receive function
75 * | '-------------'
76 * | | em_eo_stop(+notifs) / em_eo_stop_sync()
77 * | v
78 * ' .-------------.
79 * \ | STOPPING | new events discarded
80 * \ '-------------'
81 * \ |
82 * \ v
83 * \ local stops on each core
84 * \ THEN
85 * \ global stops
86 * \ .
87 * \ /
88 * -------' send 'stop-completed' notifications
89 *
90 * @{
91 */
92
95
96#ifdef __cplusplus
97extern "C" {
98#endif
99
100/**
101 * Execution Object (EO) event receive function (single-event)
102 *
103 * An application receives events through queues and these events are passed to
104 * the application's EO receive function(s) for processing. The EO receive
105 * function implements the main part of the application logic. EM calls the
106 * receive function when it has dequeued an event from one of the EO's queues.
107 * The application then processes the event and returns immediately in a
108 * run-to-completion fashion. There is no pre-emption.
109 *
110 * On multicore systems, several events (from the same or different queue) may
111 * be dequeued in parallel and thus the same receive function may be executed
112 * concurrently on several cores. Parallel execution may be limited by queue
113 * group setup or by using queues with an atomic scheduling mode.
114 *
115 * The EO and queue context pointers are user defined. The EO context is given
116 * at EO creation and the queue context is set with em_queue_set_context().
117 * These contexts may be used in any way needed, the EM implementation will not
118 * dereference them. For example, the EO context may be used to store global
119 * EO state information, which is common to all queues and events for that EO.
120 * In addition, the queue context may be used to store queue specific state data
121 * (e.g. user data flow related data). The queue context data for an atomic
122 * queue can be freely manipulated in the receive function, since only one event
123 * at a time can be under work from that particular atomic queue. For other
124 * queue types it is up to the user to synchronize context access. The EO
125 * context is protected only if the EO has one queue and it is of type 'atomic'
126 * (applies also to several atomic queues that belong to the same atomic group).
127 *
128 * An event (handle) must be converted to an event structure pointer with
129 * em_event_pointer() before accessing any data it may contain.
130 * The event type specifies the event structure in memory, which is
131 * implementation or application specific.
132 * The queue handle specifies the queue where the event was dequeued from.
133 *
134 * The EO will not receive any events if it has not been successfully started.
135 *
136 * @param eo_ctx EO context data as given to em_eo_create(), EM does not touch.
137 * @param event Event handle
138 * @param type Event type
139 * @param queue Queue from which the event was dequeued
140 * @param q_ctx Queue context data. The context pointer is set by
141 * em_queue_set_context(), EM does not touch the data.
142 *
143 * @see em_eo_create(),
144 * em_alloc(), em_free(), em_send(),
145 * em_event_pointer(), em_queue_set_context()
146 */
147typedef void (*em_receive_func_t)(void *eo_ctx,
148 em_event_t event, em_event_type_t type,
149 em_queue_t queue, void *q_ctx);
150
151/**
152 * Execution Object (EO) multi-event receive function
153 *
154 * Similar to the single-event receive function (em_receive_func_t), except that
155 * multiple events can be passed with one call to the EO receive function.
156 * A multi-event receive function is taken into use during EO creation with a
157 * call to em_eo_create_multircv(...). The maximum number of events that the
158 * multi-event EO receive function is prepared to handle can be passed with the
159 * argument 'max_events' of em_eo_create_multircv(). The EM dispatcher will
160 * split event batches larger than 'max_events' into chunks of 'max_events'.
161 *
162 * Event group handling:
163 * All events passed by the EM dispatcher to the EO multi-event receive function
164 * belong to the same event group (or none) - a batch of events containing
165 * multiple event groups is split by the dispatcher into smaller chunks, each
166 * chunk belonging to the same event group (or none).
167 * The event group count is decremented by the number of events passed to the
168 * receive function when execution returns to the dispatcher.
169 *
170 * Note: Contrary to the single-event EO receive function (em_receive_func_t),
171 * no event types are passed. Use appropriate event APIs if the event types
172 * are needed.
173 *
174 * @param eo_ctx EO context data as given to em_eo_create_multircv(),
175 * EM does not touch.
176 * @param events Event handles: events[num]
177 * @param num Number of events received
178 * (0 to 'max_events' of em_eo_create_multircv())
179 * @param queue Queue from which the event was dequeued
180 * @param q_ctx Queue context data. The context pointer is set by
181 * em_queue_set_context(), EM does not touch the data.
182 *
183 * @see em_eo_create_multircv(),
184 * em_alloc(), em_free(), em_send(),
185 * em_event_pointer(), em_queue_set_context()
186 */
187typedef void (*em_receive_multi_func_t)(void *eo_ctx,
188 em_event_t events[], int num,
189 em_queue_t queue, void *q_ctx);
190
191/**
192 * EO configuration data passed to the user provided EO start function via
193 * em_eo_start() or em_eo_start_sync().
194 * The use is optional, but provides a standard way to pass data to the
195 * EO start function. EM does not dereference any of the fields here.
196 **/
197typedef struct {
198 /** Size of the data passed via conf pointer */
199 size_t conf_len;
200 /** Application specific configuration data */
201 void *conf;
203
204/**
205 * Execution Object (EO) start function, global.
206 *
207 * This EO callback function is called once on one core by em_eo_start().
208 * The purpose of this global EO-start is to provide a placeholder for first
209 * level EO initialization, e.g. allocating memory and initializing shared data.
210 * After this global start returns, the EO core local start function (if given)
211 * is called on all cores in the EM instance. If there is no core local start,
212 * then event dispatching is enabled as this function returns, otherwise the EO
213 * is enabled only when all core local starts have completed successfully on all
214 * the cores. If this function does not return EM_OK, the system will not call
215 * the core local init and will not enable event dispatching for this EO.
216 *
217 * Note that events sent to scheduled queues from a start function are
218 * buffered. The buffered events will be sent into the queues when the EO start
219 * functions have returned - otherwise it would not be possible to send events
220 * to the EO's own queues as the EO is not yet in a started state. No buffering
221 * is done when sending to queues that are not scheduled.
222 *
223 * The last argument is an optional startup configuration passed directly
224 * from em_eo_start/_sync(). If local start functions need the configuration
225 * data, it must be saved during the global start.
226 *
227 * This function should never be directly called from the application,
228 * it will be called by em_eo_start(), which maintains state information.
229 *
230 * @param eo_ctx EO context data as given to em_eo_create(), EM does not touch.
231 * @param eo EO handle
232 * @param conf Optional startup configuration, NULL ok.
233 *
234 * @return EM_OK if successful, other values abort EO start
235 *
236 * @see em_eo_start(), em_eo_create()
237 */
238typedef em_status_t (*em_start_func_t)(void *eo_ctx, em_eo_t eo,
239 const em_eo_conf_t *conf);
240
241/**
242 * Execution Object (EO) start function, EM-core local.
243 *
244 * Similar to the global start function above, but is called after the global
245 * start function has completed and is run on all EM-cores (of types
246 * EM_CORE_TYPE_WORKER and EM_CORE_TYPE_CONTROL) of the EM instance and
247 * potentially in parallel. The local start function is not run on EM external
248 * threads/processes (of type EM_CORE_TYPE_EXTERNAL).
249 *
250 * The purpose of this optional local start function is to work as a placeholder
251 * for EM-core local initialization, e.g. allocating EM-core local memory.
252 *
253 * Note that events sent to scheduled queues from local start functions are
254 * buffered. The buffered events will be sent into the queues when the EO start
255 * functions have returned - otherwise it would not be possible to send events
256 * to the EO's own queues as the EO is not yet in a started state. No buffering
257 * is done when sending to queues that are not scheduled.
258 *
259 * This function should never be directly called from the application,
260 * it will be called by em_eo_start/_sync(), which maintains state information.
261 *
262 * Event dispatching is not enabled if this function doesn't return EM_OK on
263 * all cores.
264 *
265 * @param eo_ctx EO context data as given to em_eo_create(), EM does not touch.
266 * @param eo EO handle
267 *
268 * @return EM_OK if successful, other values prevent EO start
269 *
270 * @see em_eo_start(), em_eo_create()
271 */
272typedef em_status_t (*em_start_local_func_t)(void *eo_ctx, em_eo_t eo);
273
274/**
275 * Execution Object (EO) local start function mode.
276 *
277 * The mode determines how & when the EO's local start function is run.
278 * An EO local start function, if provided, is run on all, at the time
279 * available, EM-cores (of type EM_CORE_TYPE_WORKER or EM_CORE_TYPE_CONTROL) as
280 * triggered by em_eo_start/_sync().
281 * Adding an EM-core after the EO has already been started will not have the EO
282 * local start function triggered by em_eo_start/_sync() for the new EM-core,
283 * but the user may still want to have it run to properly initialize core local
284 * data. This option controls whether the EO's local start function is run
285 * during EM-core init when adding a new EM-core.
286 *
287 * @see em_eo_stop_local_mode_t
288 */
289typedef enum {
290 /**
291 * Use the EM config file setting from [em-odp.conf]:
292 * 'eo.start_local_fn_at_init = true/false'.
293 * This mode is set by em_eo_param_init() (default).
294 * The EM config file setting determines whether the local start
295 * functions for already started EOs are run during EM-core init
296 * when adding a new EM-core to an EM instance.
297 */
299 /**
300 * Don't run the local start function during EM-core init.
301 * The EO's start and local start functions are only run when
302 * starting the EO via em_eo_start() or em_eo_start_sync().
303 * Adding an EM-core after the EO has been started will NOT
304 * trigger any further start functions.
305 * Overrides the EM config file setting 'eo.start_local_fn_at_init' for
306 * the EO.
307 */
309 /**
310 * Run the local start function at EM-core init.
311 * Run the EO's local start function during EM-core init when a
312 * new EM-core is added to the EM instance, but only if the EO
313 * is already started/running (EM_EO_STATE_RUNNING).
314 * Overrides the EM config file setting 'eo.start_local_fn_at_init' for
315 * the EO.
316 */
318
319 /** Last, for bounds checking only */
322
323/**
324 * Execution Object (EO) stop function, EM-core local.
325 *
326 * This function is called once on each EM-core (of type EM_CORE_TYPE_WORKER or
327 * EM_CORE_TYPE_CONTROL) of the EM instance before the global stop (reverse
328 * order of start). The local stop function is not run on EM external
329 * threads/processes (of type EM_CORE_TYPE_EXTERNAL). The system disables event
330 * dispatching before calling this function and also makes sure it does not get
331 * called before the core has been notified of the stop condition for this EO
332 * (won't dispatch any new events).
333 *
334 * This function should never be directly called from the application,
335 * it will be called by em_eo_stop(), which maintains state information.
336 *
337 * @param eo_ctx EO context data as given to em_eo_create(), EM does not touch.
338 * @param eo EO handle
339 *
340 * @return EM_OK if successful.
341 *
342 * @see em_eo_stop(), em_eo_create()
343 */
344typedef em_status_t (*em_stop_local_func_t)(void *eo_ctx, em_eo_t eo);
345
346/**
347 * Execution Object (EO) local stop function mode.
348 *
349 * The mode determines how & when the EO's local stop function is run.
350 * An EO local stop function, if provided, is run on all, at the time available,
351 * EM-cores (of type EM_CORE_TYPE_WORKER or EM_CORE_TYPE_CONTROL) as triggered
352 * by em_eo_stop/_sync().
353 * Removing an EM-core before the EO has been stopped will not have the EO
354 * local stop function triggered by em_eo_stop/_sync(), but the user may still
355 * want to have it run to properly clean up EM-core local data. This option
356 * controls whether the EO's local stop function is run during EM-core
357 * termination when removing an EM-core.
358 *
359 * @see em_eo_start_local_mode_t
360 */
361typedef enum {
362 /**
363 * Use the EM config file setting from [em-odp.conf]:
364 * 'eo.stop_local_fn_at_term = true/false'.
365 * This mode is set by em_eo_param_init() (default).
366 * The EM config file setting determines whether the local stop
367 * functions for EOs are run during EM-core termination when removing an
368 * EM-core from an EM instance while the EO is still otherwise running.
369 */
371 /**
372 * Don't run the local stop function during EM-core termination.
373 * The EO's stop and local stop functions are only run when
374 * stopping the EO via em_eo_stop() or em_eo_stop_sync().
375 * Removing an EM-core while the EO is running will NOT trigger
376 * any further stop functions.
377 * Overrides the EM config file setting 'eo.stop_local_fn_at_term' for
378 * the EO.
379 */
381 /**
382 * Run the local stop function for this EO during EM-core term.
383 * Run the EO's local stop function during EM-core termination
384 * when an EM-core is removed from the EM instance, but only if
385 * the EO is already started/running (EM_EO_STATE_RUNNING).
386 * Overrides the EM config file setting 'eo.stop_local_fn_at_term' for
387 * the EO.
388 */
390
391 /** Last, for bounds checking only */
394
395/**
396 * Execution Object (EO) stop function, global.
397 *
398 * The EO global stop function is called once on one core after the optional
399 * core local stop functions return on all cores. The system disables event
400 * dispatching before calling this function and also makes sure it does not get
401 * called before all cores have been notified of the stop condition for this EO
402 * (don't dispatch new events).
403 *
404 * This function should never be directly called from the application,
405 * it will be called by em_eo_stop(), which maintains state information.
406 *
407 * @param eo_ctx EO context data as given to em_eo_create(), EM does not touch.
408 * @param eo EO handle
409 *
410 * @return EM_OK if successful.
411 *
412 * @see em_eo_stop(), em_eo_create()
413 */
414typedef em_status_t (*em_stop_func_t)(void *eo_ctx, em_eo_t eo);
415
416/**
417 * EO running state. Event dispatching is only enabled in running state.
418 **/
419typedef enum {
420 /** Undefined */
422 /** Initial state after creation */
424 /** start called, not completed */
426 /** running, event dispatching enabled */
428 /** stop called, not completed. Next state EM_EO_STATE_CREATED */
430 /** exceptional state, only delete allowed */
433
434/**
435 * Create an Execution Object (EO).
436 *
437 * Allocate an EO handle and initialize internal data for the new EO.
438 * The EO is left in a non-active state, i.e. no events are dispatched before
439 * em_eo_start() has been called. Start, stop and receive callback functions
440 * are mandatory arguments.
441 *
442 * The EO name is copied into EO internal data. The maximum length stored is
443 * EM_EO_NAME_LEN. Duplicate names are allowed, but find will only match one of
444 * them.
445 *
446 * @note The EO start/stop local function mode is read from the EM config file
447 * setting 'eo.start_local_fn_at_init' and 'eo.stop_local_fn_at_term' when
448 * using this API. Consider using the newer API em_eo_create_params()
449 * instead for more control.
450 *
451 * @param name Name of the EO (optional, NULL ok)
452 * @param start Start function
453 * @param local_start Core local start function (NULL if no local start)
454 * @param stop Stop function
455 * @param local_stop Core local stop function (NULL if no local stop)
456 * @param receive Receive function
457 * @param eo_ctx User defined EO context data, EM passes the value
458 * (NULL if no context)
459 *
460 * @return New EO handle if successful, otherwise EM_EO_UNDEF.
461 * @retval EM_EO_UNDEF on error
462 *
463 * @see em_eo_start(), em_eo_delete(), em_queue_create(), em_eo_add_queue()
464 * @see em_start_func_t, em_stop_func_t, em_receive_func_t
465 * @see em_eo_create_param(), em_eo_create_multircv()
466 */
467em_eo_t em_eo_create(const char *name,
468 em_start_func_t start, em_start_local_func_t local_start,
469 em_stop_func_t stop, em_stop_local_func_t local_stop,
470 em_receive_func_t receive, const void *eo_ctx);
471
472/**
473 * Execution Object (EO) parameters for em_eo_create_param(...)
474 */
475typedef struct {
476 /**
477 * EO start function, mandatory.
478 * Called once on one EM-core, triggered by em_eo_start/_start_sync().
479 * First EO-function to be called.
480 * The 'start' function can be called on any core type, i.e. also on
481 * EM_CORE_TYPE_EXTERNAL if em_eo_start/start_sync() is called from
482 * there.
483 */
485 /**
486 * EO core-local start function, optional (set NULL if not used).
487 * Called on all EM-cores (of type EM_CORE_TYPE_WORKER or
488 * EM_CORE_TYPE_CONTROL) after 'start' has completed.
489 */
491 /**
492 * EO local start function mode (see type documentation), set if using a
493 * local start function.
494 */
496
497 /**
498 * EO stop function, mandatory.
499 * Called once on one EM-core, triggered by em_eo_stop/_stop_sync().
500 * Last EO-function to be called.
501 * The 'stop' function can be called on any core type, i.e. also on
502 * EM_CORE_TYPE_EXTERNAL if em_eo_stop/stop_sync() is called from
503 * there.
504 */
506 /**
507 * EO core-local stop function, optional (set NULL if not used).
508 * Called and completed on all EM-cores (of type EM_CORE_TYPE_WORKER or
509 * EM_CORE_TYPE_CONTROL) before 'stop'.
510 */
512 /**
513 * EO local stop function mode (see type documentation), set if using a
514 * local stop function.
515 */
517
518 /**
519 * EO receive function for multiple events, mandatory.
520 * Only EM-cores of type of type EM_CORE_TYPE_WORKER or
521 * EM_CORE_TYPE_CONTROL will run this function.
522 */
524 /**
525 * User defined EO context data, optional (NULL if no context).
526 * EM only passes the value.
527 */
528 const void *eo_ctx;
529
530 /**
531 * Internal check - don't touch!
532 *
533 * EM will verify that em_eo_param_init(param) has been called
534 * before creating an EO with em_eo_create_param(..., param)
535 */
538
539/**
540 * Initialize parameters for Execution Object (EO) creation.
541 *
542 * Initialize em_eo_param_t to default values for all fields.
543 * After initialization, the user further needs to set the mandatory fields of
544 * 'em_eo_param_t' before calling em_eo_create_param().
545 * Always initialize 'param' first with em_eo_param_init(&param) to
546 * ensure backwards compatibility with potentially added new options.
547 *
548 * @param param Address of the em_eo_param_t to be initialized
549 *
550 * @see em_eo_create_param()
551 */
553
554/**
555 * Create an Execution Object (EO) with parameters
556 *
557 * Allocate an EO handle and initialize internal data for the new EO.
558 * The EO is left in a non-active state, i.e. no events are dispatched before
559 * em_eo_start/_sync() has been called.
560 *
561 * The EO name is copied into EO internal data. The maximum length stored is
562 * EM_EO_NAME_LEN. Duplicate names are allowed, but find will only match one of
563 * them.
564 *
565 * Always initialize 'param' first with em_eo_param_init(&param) to ensure
566 * backwards compatibility and default values for all fields before setting your
567 * own params and calling em_eo_create_param():
568 * @code
569 * em_eo_param_t param;
570 * em_eo_t eo;
571 *
572 * em_eo_param_init(&param); - Set default values for all fields
573 * param.start = my_start_fn;
574 * param.stop = my_stop_fn;
575 * param.receive = my_receive_fn;
576 * ...
577 * eo = em_eo_create_param("my-eo", &param);
578 * if (unlikely(eo == EM_EO_UNDEF))
579 * report_error();
580 * @endcode
581 *
582 * @param name Name of the EO (optional, NULL ok)
583 * @param param EO parameters
584 *
585 * @return New EO handle if successful, otherwise EM_EO_UNDEF.
586 * @retval EM_EO_UNDEF on error
587 */
588em_eo_t em_eo_create_param(const char *name, const em_eo_param_t *param);
589
590/**
591 * Execution Object (EO) parameters for em_eo_create_multircv(...)
592 */
593typedef struct {
594 /**
595 * EO start function, mandatory.
596 * Called once on one core, triggered by em_eo_start/_start_sync().
597 * First EO-function to be called.
598 */
600 /**
601 * EO core-local start function, optional (set NULL if not used).
602 * Called on all EM-cores after 'start' has completed.
603 */
605 /**
606 * EO local start function mode (see type documentation)
607 */
609
610 /**
611 * EO stop function, mandatory.
612 * Called once on one core, triggered by em_eo_stop/_stop_sync().
613 * Last EO-function to be called.
614 */
616 /**
617 * EO core-local stop function, optional (set NULL if not used).
618 * Called and completed on all EM-cores before 'stop'.
619 */
621 /**
622 * EO local stop function mode (see type documentation)
623 */
625
626 /**
627 * EO receive function for multiple events, mandatory.
628 */
630 /**
631 * Maximum number of events passed to the receive function.
632 * EM will dispatch 1 to 'max-events' at a time to the EO's multi-event
633 * receive function.
634 * Use '0' for an EM default value (=EM_EO_MULTIRCV_MAX_EVENTS).
635 * The user provided 'receive_multi' function must be able to handle
636 * 'max_events' events at a time.
637 */
639 /**
640 * User defined EO context data, optional (NULL if no context).
641 * EM only passes the value.
642 */
643 const void *eo_ctx;
644
645 /**
646 * Internal check - don't touch!
647 *
648 * EM will verify that em_eo_multircv_param_init(param) has been called
649 * before creating an EO with em_eo_create_multircv(..., param)
650 */
653
654/**
655 * Initialize parameters for the Execution Object (EO) with a
656 * multi-event receive-function.
657 *
658 * Initialize em_eo_multircv_param_t to default values for all fields.
659 * After initialization, the user further needs to set the mandatory fields of
660 * 'em_eo_multircv_param_t' before calling em_eo_create_multircv().
661 * Always initialize 'param' first with em_eo_multircv_param_init(&param) to
662 * ensure backwards compatibility with potentially added new options.
663 *
664 * @param param Address of the em_eo_multircv_param_t to be initialized
665 *
666 * @see em_eo_create_multircv()
667 */
669
670/**
671 * Create an Execution Object (EO) with a multi-event receive function.
672 *
673 * Similar to em_eo_create(), except that an EO multi-event receive function is
674 * taken into use for the created EO, see em_receive_multi_func_t (passed via
675 * em_eo_multircv_param_t param).
676 *
677 * Always initialize 'param' first with em_eo_multircv_param_init(&param) to
678 * ensure backwards compatibility before setting your own params and calling
679 * em_eo_create_multircv():
680 * @code
681 * em_eo_multircv_param_t param;
682 * em_eo_t eo;
683 *
684 * em_eo_multircv_param_init(&param);
685 * param.start = my_start_fn;
686 * param.stop = my_stop_fn;
687 * param.receive_multi = my_receive_multi_fn;
688 * param.max_events = MY_MAX_EVENTS; // or use default=0
689 * ...
690 * eo = em_eo_create_multircv("my-eo", &param);
691 * if (unlikely(eo == EM_EO_UNDEF))
692 * report_error();
693 * @endcode
694 *
695 * @param name Name of the EO (optional, NULL ok)
696 * @param param EO parameters
697 *
698 * @return New EO handle if successful, otherwise EM_EO_UNDEF.
699 *
700 * @see em_eo_multircv_param_init()
701 * @see em_eo_start(), em_eo_start_sync(), em_eo_stop(), em_eo_stop_sync()
702 * @see em_start_func_t, em_stop_func_t, em_receive_multi_func_t
703 */
704em_eo_t em_eo_create_multircv(const char *name,
705 const em_eo_multircv_param_t *param);
706
707/**
708 * Delete an Execution Object (EO).
709 *
710 * Immediately delete the given EO and free the identifier.
711 *
712 * NOTE, that an EO can only be deleted after it has been stopped using
713 * em_eo_stop() with notifications or em_eo_stop_sync(), otherwise another core
714 * might still access the EO data.
715 * All associated queues must be removed before deleting an EO.
716 *
717 * A sequence of
718 * @code
719 * em_eo_stop_sync(eo);
720 * em_eo_remove_queue_all_sync(eo, EM_TRUE);
721 * em_eo_delete(eo);
722 * @endcode
723 * will cleanly delete an EO from the EM point of view (not including user
724 * allocated data).
725 *
726 * @param eo EO handle to delete
727 *
728 * @return EM_OK if successful.
729 *
730 * @see em_eo_stop(), em_eo_remove_queue()
731 */
732em_status_t em_eo_delete(em_eo_t eo);
733
734/**
735 * Returns the name given to the Execution Object (EO) when it was created.
736 *
737 * A copy of the name string (up to 'maxlen' characters) is
738 * written to the user buffer 'name'.
739 * The string is always null terminated - even if the given buffer length
740 * is less than the name length.
741 *
742 * The function returns 0 and writes an empty string if the EO has no name.
743 *
744 * @param eo EO handle
745 * @param[out] name Destination buffer
746 * @param maxlen Maximum length (including the terminating '0')
747 *
748 * @return Number of characters written (excludes the terminating '0').
749 *
750 * @see em_eo_create()
751 */
752size_t em_eo_name(em_eo_t eo, char *name, size_t maxlen);
753
754/* Backwards compatible naming ("get") */
755#define em_eo_get_name em_eo_name
756
757/**
758 * Find Execution Object (EO) by name.
759 *
760 * Finds an EO by the given name (exact match). An empty string will not match
761 * anything. The search is case sensitive. This function will return the first
762 * match only if there are duplicate names.
763 *
764 * @param name the name to look for
765 *
766 * @return EO handle or EM_EO_UNDEF if not found
767 *
768 * @see em_eo_create()
769 */
770em_eo_t em_eo_find(const char *name);
771
772/**
773 * Add a queue to an Execution Object (EO), asynchronous (non-blocking)
774 *
775 * Add the given queue to the EO and enable scheduling for it. The function
776 * returns immediately, but the operation can be asynchronous and only fully
777 * complete later. The given notification events are sent when the operation has
778 * completed and the queue is ready to receive events.
779 * Note, that the completion notification(s) guarantee that the queue itself is
780 * operational, but if the target EO is not yet started then events sent into
781 * the queue will still be dropped by dispatcher.
782 *
783 * @param eo EO handle
784 * @param queue Queue handle
785 * @param num_notif Number of notification events, 0 for no notification
786 * @param notif_tbl Array of pairs of event and queue identifiers
787 * (+ optional event groups to send the events with)
788 *
789 * @return EM_OK if successful.
790 *
791 * @see em_queue_create(), em_eo_create(), em_eo_remove_queue(),
792 * em_eo_add_queue_sync()
793 */
794em_status_t em_eo_add_queue(em_eo_t eo, em_queue_t queue,
795 int num_notif, const em_notif_t notif_tbl[]);
796
797/**
798 * Add a queue to an Execution Object (EO), synchronous (blocking)
799 *
800 * As em_eo_add_queue(), but does not return until the queue is ready to
801 * receive events.
802 *
803 * Note that the function is blocking and will not return until the operation
804 * has completed across all concerned EM cores.
805 * Sync-API calls can block the core for a long (indefinite) time, thus they
806 * should not be used to make runtime changes on real time EM cores - consider
807 * the async variants of the APIs in these cases instead.
808 * While one core is calling a sync-API function, the others must be running the
809 * EM dispatch loop to be able to receive and handle the sync-API request events
810 * sent internally.
811 * Use the sync-APIs mainly to simplify application start-up or teardown.
812 *
813 * @param eo EO handle
814 * @param queue Queue handle
815 *
816 * @return EM_OK if successful.
817 *
818 * @see em_queue_create(), em_eo_create(), em_eo_remove_queue()
819 * @see em_eo_add_queue() for an asynchronous version of the API
820 */
821em_status_t em_eo_add_queue_sync(em_eo_t eo, em_queue_t queue);
822
823/**
824 * Removes a queue from an Execution Object (EO), asynchronous (non-blocking)
825 *
826 * Disables queue scheduling and removes the queue from the EO. The function
827 * returns immediately, but the operation can be asynchronous and only fully
828 * complete later. The given notification events are sent when the operation has
829 * completed across all cores and no event from this queue is being dispatched
830 * anymore. Use notifications to know when the operation has fully completed
831 * and the queue can safely be deleted.
832 *
833 * @param eo EO handle
834 * @param queue Queue handle to remove
835 * @param num_notif Number of notification events, 0 for no notification
836 * @param notif_tbl Array of pairs of event and queue identifiers
837 * (+ optional event groups to send the events with)
838 *
839 * @return EM_OK if successful.
840 *
841 * @see em_eo_add_queue(), em_eo_remove_queue_sync()
842 */
843em_status_t em_eo_remove_queue(em_eo_t eo, em_queue_t queue,
844 int num_notif, const em_notif_t notif_tbl[]);
845
846/**
847 * Removes a queue from an Execution Object (EO), synchronous (blocking)
848 *
849 * As em_eo_remove_queue(), but will not return until the queue has been
850 * disabled, removed from the EO and no more events are being processed from
851 * the queue.
852 *
853 * Note that the function is blocking and will not return until the operation
854 * has completed across all concerned EM cores.
855 * Sync-API calls can block the core for a long (indefinite) time, thus they
856 * should not be used to make runtime changes on real time EM cores - consider
857 * the async variants of the APIs in these cases instead.
858 * While one core is calling a sync-API function, the others must be running the
859 * EM dispatch loop to be able to receive and handle the sync-API request events
860 * sent internally.
861 * Use the sync-APIs mainly to simplify application start-up or teardown.
862 *
863 * @param eo EO handle
864 * @param queue Queue handle to remove
865 *
866 * @return EM_OK if successful.
867 *
868 * @see em_eo_remove_queue() for an asynchronous version of the API
869 */
870em_status_t em_eo_remove_queue_sync(em_eo_t eo, em_queue_t queue);
871
872/**
873 * Removes all queues from an Execution Object (EO), asynchronous (non-blocking)
874 *
875 * Like em_eo_remove_queue(), but removes all queues currently associated with
876 * the EO.
877 * The argument 'delete_queues' can be used to automatically also delete all
878 * queues by setting it to EM_TRUE (EM_FALSE otherwise).
879 * Note: any allocated queue contexts will still need to be handled elsewhere.
880 *
881 * @param eo EO handle
882 * @param delete_queues delete the EO's queues if set to EM_TRUE
883 * @param num_notif Number of notification events, 0 for no notification
884 * @param notif_tbl Array of pairs of event and queue identifiers
885 * (+ optional event groups to send the events with)
886 *
887 * @return EM_OK if successful.
888 *
889 * @see em_eo_add_queue(), em_eo_remove_queue_sync(),
890 * em_eo_remove_queue_all_sync()
891 */
892em_status_t em_eo_remove_queue_all(em_eo_t eo, int delete_queues,
893 int num_notif, const em_notif_t notif_tbl[]);
894
895/**
896 * Removes all queues from an Execution Object (EO), synchronous (blocking).
897 *
898 * As em_eo_remove_queue_all(), but does not return until all queues have
899 * been removed.
900 *
901 * Note that the function is blocking and will not return until the operation
902 * has completed across all concerned EM cores.
903 * Sync-API calls can block the core for a long (indefinite) time, thus they
904 * should not be used to make runtime changes on real time EM cores - consider
905 * the async variants of the APIs in these cases instead.
906 * While one core is calling a sync-API function, the others must be running the
907 * EM dispatch loop to be able to receive and handle the sync-API request events
908 * sent internally.
909 * Use the sync-APIs mainly to simplify application start-up or teardown.
910 *
911 * @param eo EO handle
912 * @param delete_queues delete the EO's queues if set to EM_TRUE
913 *
914 * @return EM_OK if successful.
915 *
916 *
917 * @see em_eo_remove_queue_all() for an asynchronous version of the API
918 */
919em_status_t em_eo_remove_queue_all_sync(em_eo_t eo, int delete_queues);
920
921/**
922 * Register an Execution Object (EO) specific error handler.
923 *
924 * The EO specific error handler is called if an error occurs or em_error() is
925 * called in the context of the running EO.
926 * Note, the provided function will override any previously registered
927 * error handler for the EO in question.
928 * The global error handler is called if no EO specific error handler is
929 * registered.
930 *
931 * @param eo EO handle
932 * @param handler New error handler
933 *
934 * @return EM_OK if successful.
935 *
936 * @see em_register_error_handler(), em_error_handler_t()
937 */
939
940/**
941 * Unregister an Execution Object (EO) specific error handler.
942 *
943 * Removes a previously registered EO specific error handler and restores the
944 * global error handler into use for the EO.
945 *
946 * @param eo EO handle
947 *
948 * @return EM_OK if successful.
949 */
951
952/**
953 * Start an Execution Object (EO), asynchronous (non-blocking)
954 *
955 * Start and enable a previously created EO.
956 * The em_eo_start() function will first call the user provided global EO start
957 * function. If that global start function returns EM_OK then events to trigger
958 * the (optional) user provided local start function are sent to all EM-cores.
959 * The em_eo_start() function returns immediately after the global start
960 * returns, which means that the action only fully completes later.
961 * Notifications should be used if the caller needs to know when the EO start
962 * has fully completed. The given notification event(s) will be sent to the
963 * given queue(s) when the start is completed on all cores.
964 *
965 * The EO's global start function can be called on any core type, i.e. also on
966 * EM_CORE_TYPE_EXTERNAL if em_eo_start() is called from there.
967 *
968 * Local start is not called and event dispatching is not enabled for this EO if
969 * the global start function does not return EM_OK.
970 *
971 * The notification(s) are sent when the global start function returns if a
972 * local start function hasn't been provided.
973 * Use '0' as 'num_notif' if notifications are not needed. Be aware of,
974 * is this case, that the EO may not immediately be ready to handle events.
975 *
976 * Note that events sent to scheduled queues from a user provided EO global or
977 * local start function are buffered. The buffered events will be sent into the
978 * queues when the EO start functions have all returned - otherwise it would not
979 * be possible to send events to the EO's own queues as the EO is not yet in a
980 * started state. No buffering is done when sending to queues that are
981 * not scheduled.
982 *
983 * The optional conf-argument can be used to pass applification specific
984 * information (e.g. configuration data) to the EO.
985 *
986 * @param eo EO handle
987 * @param[out] result Optional pointer to em_status_t, which gets updated to
988 * the return value of the actual user provided EO global
989 * start function.
990 * @param conf Optional startup configuration, NULL ok.
991 * @param num_notif If not 0, defines the number of notification events to
992 * send when all cores have returned from the start
993 * function(s).
994 * @param notif_tbl Array of em_notif_t, the optional notification events
995 * (array data is copied)
996 *
997 * @return EM_OK if successful.
998 *
999 * @see em_start_func_t(), em_start_local_func_t(), em_eo_stop(),
1000 * em_eo_start_sync()
1001 */
1002em_status_t em_eo_start(em_eo_t eo, em_status_t *result, const em_eo_conf_t *conf,
1003 int num_notif, const em_notif_t notif_tbl[]);
1004
1005/**
1006 * Start Execution Object (EO), synchronous (blocking)
1007 *
1008 * As em_eo_start(), but will not return until the operation is complete.
1009 *
1010 * Note that the function is blocking and will not return until the operation
1011 * has completed across all concerned EM cores.
1012 * Sync-API calls can block the core for a long (indefinite) time, thus they
1013 * should not be used to make runtime changes on real time EM cores - consider
1014 * the async variants of the APIs in these cases instead.
1015 * While one EM-core is calling a sync-API function, the others must be running
1016 * the EM dispatch loop to be able to receive and handle the sync-API request
1017 * events sent internally.
1018 * Use the sync-APIs mainly to simplify application start-up or teardown.
1019 *
1020 * The EO's global start function can be called on any core type, i.e. also on
1021 * EM_CORE_TYPE_EXTERNAL if em_eo_start_sync() is called from there.
1022 *
1023 * @param eo EO handle
1024 * @param[out] result Optional pointer to em_status_t, which gets updated to
1025 * the return value of the actual user provided EO global
1026 * start function.
1027 * @param conf Optional startup configuration, NULL ok.
1028 *
1029 * @return EM_OK if successful.
1030 *
1031 * @see em_start_func_t(), em_start_local_func_t(), em_eo_stop()
1032 * @see em_eo_start() for an asynchronous version of the API
1033 */
1034em_status_t em_eo_start_sync(em_eo_t eo, em_status_t *result,
1035 const em_eo_conf_t *conf);
1036
1037/**
1038 * Stop Execution Object (EO), asynchronous (non-blocking)
1039 *
1040 * Disables event dispatch from all related queues, calls core local stop
1041 * on all cores and finally calls the global stop function of the EO when all
1042 * cores have returned from the (optional) core local stop.
1043 * The call to the global EO stop is asynchronous and only done when all cores
1044 * have completed processing of the receive function and/or core local stop.
1045 * This guarantees no other core is accessing EO data during the EO global stop
1046 * function.
1047 *
1048 * The EO's global stop function can be called on any core type, i.e. also on
1049 * EM_CORE_TYPE_EXTERNAL if em_eo_stop() is called from there.
1050 *
1051 * This function returns immediately, but may only fully complete later. If the
1052 * caller needs to know when the EO stop has actually completed, the num_notif
1053 * and notif_tbl should be used. The given notification event(s) will be sent to
1054 * given queue(s) when the stop operation actually completes.
1055 * If such notifications are not needed, use '0' as 'num_notif'.
1056 *
1057 * When the EO has stopped it can be started again with em_eo_start().
1058 *
1059 * @param eo EO handle
1060 * @param num_notif Number of notification events, 0 for no notification
1061 * @param notif_tbl Array of pairs of event and queue identifiers
1062 * (+ optional event groups to send the events with)
1063 *
1064 * @return EM_OK if successful.
1065 *
1066 * @see em_stop_func_t(), em_stop_local_func_t(), em_eo_start(),
1067 * em_eo_stop_sync()
1068 */
1069em_status_t em_eo_stop(em_eo_t eo, int num_notif, const em_notif_t notif_tbl[]);
1070
1071/**
1072 * Stop Execution Object (EO), synchronous (blocking)
1073 *
1074 * As em_eo_stop(), but will not return until the operation is complete.
1075 *
1076 * Note that the function is blocking and will not return until the operation
1077 * has completed across all concerned EM cores.
1078 * Sync-API calls can block the core for a long (indefinite) time, thus they
1079 * should not be used to make runtime changes on real time EM cores - consider
1080 * the async variants of the APIs in these cases instead.
1081 * While one core is calling a sync-API function, the others must be running the
1082 * EM dispatch loop to be able to receive and handle the sync-API request events
1083 * sent internally.
1084 * Use the sync-APIs mainly to simplify application start-up or teardown.
1085 *
1086 * The EO's global stop function can be called on any core type, i.e. also on
1087 * EM_CORE_TYPE_EXTERNAL if em_eo_stop_sync() is called from there.
1088 *
1089 * @param eo EO handle
1090 *
1091 * @return EM_OK if successful.
1092 *
1093 * @see em_stop_func_t(), em_stop_local_func_t(), em_eo_start()
1094 * @see em_eo_stop() for an asynchronous version of the API
1095 */
1096em_status_t em_eo_stop_sync(em_eo_t eo);
1097
1098/**
1099 * Return the currently active Execution Object (EO)
1100 *
1101 * Returns the EO handle associated with the currently running EO function.
1102 * Only valid if called within an EO-context, will return EM_EO_UNDEF otherwise.
1103 * Can be called from the EO-receive or EO-start/stop functions (or subfunctions
1104 * thereof).
1105 * Note that calling em_eo_current() from e.g. an EO-start function that was
1106 * launched from within another EO's receive will return the EO handle of the
1107 * EO being started - i.e. always returns the 'latest' current EO.
1108 *
1109 * @return The current EO or EM_EO_UNDEF if no current EO (or error)
1110 */
1111em_eo_t em_eo_current(void);
1112
1113/**
1114 * Get Execution Object (EO) specific (application) context.
1115 *
1116 * Returns the EO context pointer that the application has earlier provided via
1117 * em_eo_create/_param() or em_eo_create_multircv() for the given EO.
1118 *
1119 * @param eo EO for which the context is requested
1120 *
1121 * @return EO specific context pointer or NULL if no context (or error)
1122 */
1123void *em_eo_context(em_eo_t eo);
1124
1125/* Backwards compatible naming ("get") */
1126#define em_eo_get_context em_eo_context
1127
1128/**
1129 * Return the Execution Object (EO) state.
1130 *
1131 * Returns the current state of the given EO.
1132 *
1133 * @return The current EO state or EM_EO_STATE_UNDEF if never created.
1134 */
1135em_eo_state_t em_eo_state(em_eo_t eo);
1136
1137/* Backwards compatible naming ("get") */
1138#define em_eo_get_state em_eo_state
1139
1140/**
1141 * Initialize Execution Object (EO) iteration and return the first EO handle.
1142 *
1143 * Can be used to initialize the iteration to retrieve all created EOs for
1144 * debugging or management purposes. Use em_eo_next() after this call until
1145 * it returns EM_EO_UNDEF. A new call to em_eo_first() resets the iteration,
1146 * which is maintained per core (thread). The operation should be completed in
1147 * one go before returning from the EO's event receive function (or start/stop).
1148 *
1149 * The number of EOs (output arg 'num') may not match the amount of EOs actually
1150 * returned by iterating using em_eo_next() if EOs are added or removed in
1151 * parallel by another core. The order of the returned EO handles is undefined.
1152 *
1153 * @code
1154 * unsigned int num;
1155 * em_eo_t eo = em_eo_first(&num);
1156 * while (eo != EM_EO_UNDEF) {
1157 * eo = em_eo_next();
1158 * }
1159 * @endcode
1160 *
1161 * @param[out] num Pointer to an unsigned int to store the amount of EOs into
1162 * @return The first EO handle or EM_EO_UNDEF if none exist
1163 *
1164 * @see em_eo_next()
1165 */
1166em_eo_t em_eo_first(unsigned int *num);
1167
1168/* Backwards compatible naming ("get") */
1169#define em_eo_get_first em_eo_first
1170
1171/**
1172 * Return the next Execution Object (EO) handle.
1173 *
1174 * Continues the EO iteration started by em_eo_first() and returns the next
1175 * EO handle.
1176 *
1177 * @return The next EO handle or EM_EO_UNDEF if the EO iteration is completed
1178 * (i.e. no more EO's available).
1179 *
1180 * @see em_eo_first()
1181 */
1182em_eo_t em_eo_next(void);
1183
1184/* Backwards compatible naming ("get") */
1185#define em_eo_get_next em_eo_next
1186
1187/**
1188 * Initialize iteration of an Execution Object's (EO) queues and
1189 * return the first queue handle.
1190 *
1191 * Can be used to initialize the iteration to retrieve all queues associated
1192 * with the given EO for debugging or management purposes.
1193 * Use em_eo_queue_next() after this call until it returns EM_QUEUE_UNDEF.
1194 * A new call to em_eo_queue_first() resets the iteration, which is
1195 * maintained per core (thread). The operation should be started and completed
1196 * in one go before returning from the EO's event receive function (or
1197 * start/stop).
1198 *
1199 * The number of queues owned by the EO (output arg 'num') may not match the
1200 * amount of queues actually returned by iterating using em_eo_queue_next()
1201 * if queues are added or removed in parallel by another core. The order of
1202 * the returned queue handles is undefined.
1203 *
1204 * Simplified example:
1205 * @code
1206 * unsigned int num;
1207 * em_queue_t q = em_eo_queue_first(&num, eo);
1208 * while (q != EM_QUEUE_UNDEF) {
1209 * q = em_eo_queue_next();
1210 * }
1211 * @endcode
1212 *
1213 * @param[out] num Output the current amount of queues associated with the EO
1214 * @param eo EO handle
1215 *
1216 * @return The first queue handle or EM_QUEUE_UNDEF if none exist or the EO
1217 * is invalid.
1218 *
1219 * @see em_eo_queue_next()
1220 **/
1221em_queue_t em_eo_queue_first(unsigned int *num, em_eo_t eo);
1222
1223/* Backwards compatible naming ("get") */
1224#define em_eo_queue_get_first em_eo_queue_first
1225
1226/**
1227 * Return the Execution Object's (EO) next queue handle.
1228 *
1229 * Continues the queue iteration started by em_eo_queue_first() and returns
1230 * the next queue handle owned by the EO.
1231 *
1232 * @return The next queue handle or EM_QUEUE_UNDEF if the queue iteration is
1233 * completed (i.e. no more queues available for this EO).
1234 *
1235 * @see em_eo_queue_first()
1236 **/
1237em_queue_t em_eo_queue_next(void);
1238
1239/* Backwards compatible naming ("get") */
1240#define em_eo_queue_get_next em_eo_queue_next
1241
1242/**
1243 * Convert an Execution Object (EO) handle to an unsigned integer
1244 *
1245 * @param eo EO handle to be converted
1246 * @return uint64_t value that can be used to print/display the handle
1247 *
1248 * @note This routine is intended to be used for diagnostic purposes
1249 * to enable applications to e.g. generate a printable value that represents
1250 * an em_eo_t handle.
1251 */
1252uint64_t em_eo_to_u64(em_eo_t eo);
1253
1254/**
1255 * @}
1256 */
1257#ifdef __cplusplus
1258}
1259#endif
1260
1261#pragma GCC visibility pop
1262#endif /* EVENT_MACHINE_EO_H_ */
uint32_t em_event_type_t
em_status_t em_eo_register_error_handler(em_eo_t eo, em_error_handler_t handler)
em_status_t em_eo_remove_queue_all_sync(em_eo_t eo, int delete_queues)
em_eo_t em_eo_first(unsigned int *num)
em_eo_t em_eo_current(void)
em_eo_t em_eo_create(const char *name, em_start_func_t start, em_start_local_func_t local_start, em_stop_func_t stop, em_stop_local_func_t local_stop, em_receive_func_t receive, const void *eo_ctx)
em_status_t em_eo_remove_queue_all(em_eo_t eo, int delete_queues, int num_notif, const em_notif_t notif_tbl[])
size_t em_eo_name(em_eo_t eo, char *name, size_t maxlen)
em_status_t em_eo_remove_queue(em_eo_t eo, em_queue_t queue, int num_notif, const em_notif_t notif_tbl[])
em_status_t em_eo_start(em_eo_t eo, em_status_t *result, const em_eo_conf_t *conf, int num_notif, const em_notif_t notif_tbl[])
em_eo_start_local_mode_t
em_status_t em_eo_stop(em_eo_t eo, int num_notif, const em_notif_t notif_tbl[])
em_eo_state_t
em_status_t(* em_start_local_func_t)(void *eo_ctx, em_eo_t eo)
void(* em_receive_func_t)(void *eo_ctx, em_event_t event, em_event_type_t type, em_queue_t queue, void *q_ctx)
em_status_t(* em_stop_func_t)(void *eo_ctx, em_eo_t eo)
em_eo_stop_local_mode_t
em_status_t(* em_stop_local_func_t)(void *eo_ctx, em_eo_t eo)
em_eo_t em_eo_next(void)
em_eo_t em_eo_find(const char *name)
void em_eo_param_init(em_eo_param_t *param)
em_queue_t em_eo_queue_next(void)
em_queue_t em_eo_queue_first(unsigned int *num, em_eo_t eo)
em_status_t em_eo_start_sync(em_eo_t eo, em_status_t *result, const em_eo_conf_t *conf)
void * em_eo_context(em_eo_t eo)
em_status_t em_eo_unregister_error_handler(em_eo_t eo)
em_status_t em_eo_add_queue(em_eo_t eo, em_queue_t queue, int num_notif, const em_notif_t notif_tbl[])
void em_eo_multircv_param_init(em_eo_multircv_param_t *param)
em_status_t em_eo_add_queue_sync(em_eo_t eo, em_queue_t queue)
em_eo_state_t em_eo_state(em_eo_t eo)
em_status_t(* em_start_func_t)(void *eo_ctx, em_eo_t eo, const em_eo_conf_t *conf)
em_status_t em_eo_stop_sync(em_eo_t eo)
uint64_t em_eo_to_u64(em_eo_t eo)
em_status_t em_eo_delete(em_eo_t eo)
em_status_t em_eo_remove_queue_sync(em_eo_t eo, em_queue_t queue)
em_eo_t em_eo_create_multircv(const char *name, const em_eo_multircv_param_t *param)
em_eo_t em_eo_create_param(const char *name, const em_eo_param_t *param)
void(* em_receive_multi_func_t)(void *eo_ctx, em_event_t events[], int num, em_queue_t queue, void *q_ctx)
@ EM_EO_START_LOCAL_MODE_INIT_NORUN
@ EM_EO_START_LOCAL_MODE_CONFIG_FILE
@ EM_EO_START_LOCAL_MODE_LAST
@ EM_EO_START_LOCAL_MODE_INIT_RUN
@ EM_EO_STATE_STOPPING
@ EM_EO_STATE_CREATED
@ EM_EO_STATE_RUNNING
@ EM_EO_STATE_ERROR
@ EM_EO_STATE_UNDEF
@ EM_EO_STATE_STARTING
@ EM_EO_STOP_LOCAL_MODE_TERM_RUN
@ EM_EO_STOP_LOCAL_MODE_CONFIG_FILE
@ EM_EO_STOP_LOCAL_MODE_LAST
@ EM_EO_STOP_LOCAL_MODE_TERM_NORUN
em_status_t(* em_error_handler_t)(em_eo_t eo, em_status_t error, em_escope_t escope, va_list args)
uint32_t em_status_t
em_start_local_func_t local_start
em_eo_start_local_mode_t local_start_mode
em_receive_multi_func_t receive_multi
em_stop_local_func_t local_stop
em_eo_stop_local_mode_t local_stop_mode
em_eo_start_local_mode_t local_start_mode
em_start_func_t start
em_stop_local_func_t local_stop
uint32_t __internal_check
em_eo_stop_local_mode_t local_stop_mode
em_stop_func_t stop
const void * eo_ctx
em_start_local_func_t local_start
em_receive_func_t receive