EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
em_init.h File Reference
#include <stdbool.h>
#include <event_machine.h>
#include "em_mem.h"
Include dependency graph for em_init.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EM_LOCM_INIT_VALUES   {.core_id = -2, .local_queues.empty = 1 /* rest '0' */}
 

Functions

bool is_core_initialized (void)
 
void core_log_fn_set (em_log_func_t func)
 
void core_vlog_fn_set (em_vlog_func_t func)
 
em_status_t init_cli_thread (void)
 
em_status_t sync_api_init_local (void)
 
em_status_t init_local (const em_conf_local_t *conf_local, em_escope_t escope)
 
em_status_t init_extthr (const em_conf_local_t *conf_local, em_escope_t escope)
 
void flush_scheduler_events (void)
 
em_status_t term_core (em_escope_t escope)
 
em_status_t term_extthr (em_escope_t escope)
 
void cfgfile_opts_print (void)
 
void conf_opts_print (void)
 
void conf_local_opts_print (void)
 

Variables

const em_locm_t locm_init_values
 

Detailed Description

EM internal initialization

Definition in file em_init.h.

Macro Definition Documentation

◆ EM_LOCM_INIT_VALUES

#define EM_LOCM_INIT_VALUES   {.core_id = -2, .local_queues.empty = 1 /* rest '0' */}

Init values for the em_locm_t struct.

Set only non-zero init values, other members initialized to '0' as per C standard when used to initialize a global struct.

.core_id: 0 to EM_MAX_CORES-1 for EM_CORE_TYPE_WORKER or EM_CORE_TYPE_CONTROL -1 for EM_CORE_TYPE_EXTERNAL Undefined for threads/processes not initialized as EM-cores Set here to -2 to distinguish from EM_CORE_TYPE_EXTERNAL when not yet initialized via em_init_local()/em_init_core().

Definition at line 61 of file em_init.h.

Function Documentation

◆ cfgfile_opts_print()

void cfgfile_opts_print ( void  )

Definition at line 525 of file em_init.c.

◆ conf_local_opts_print()

void conf_local_opts_print ( void  )

Definition at line 670 of file em_init.c.

◆ conf_opts_print()

void conf_opts_print ( void  )

Definition at line 708 of file em_init.c.

◆ core_log_fn_set()

void core_log_fn_set ( em_log_func_t  func)

Set EM core local log function.

Called by EM-core (= process, thread or bare metal core) when a different log function than EM internal log is needed.

Definition at line 96 of file em_init.c.

◆ core_vlog_fn_set()

void core_vlog_fn_set ( em_vlog_func_t  func)

Set EM core local log function with va_list.

Called by EM-core (= process, thread or bare metal core) when a different log function than EM internal log is needed.

Definition at line 103 of file em_init.c.

◆ flush_scheduler_events()

void flush_scheduler_events ( void  )

Definition at line 341 of file em_init.c.

◆ init_cli_thread()

em_status_t init_cli_thread ( void  )

Initialize an external thread for the EM CLI.

This function makes sure that EM shared memory has been setup properly before an EM external thread is created.

Must be called once by non EM core which wants to access EM shared memory or use EM APIs.

Returns
EM_OK if successful.

Definition at line 110 of file em_init.c.

◆ init_extthr()

em_status_t init_extthr ( const em_conf_local_t conf_local,
em_escope_t  escope 
)

Definition at line 304 of file em_init.c.

◆ init_local()

em_status_t init_local ( const em_conf_local_t conf_local,
em_escope_t  escope 
)

Definition at line 215 of file em_init.c.

◆ is_core_initialized()

bool is_core_initialized ( void  )

Check whether the current thread/process has already completed EM core-local initialization.

Works uniformly for both thread-per-core and process-per-core modes:

  • If locm->init_pid != getpid(), TLS is stale (first use or post-fork child) and the core is treated as not initialized.
  • Otherwise returns locm->is_core_local_inited, which is set true by em_init_local()/em_init_core() after successful core-local initialization.

This is a pure check with no side effects. init_thr_mem() sets init_pid and em_init_local()/em_init_core() set is_core_local_inited.

Definition at line 53 of file em_init.c.

◆ sync_api_init_local()

em_status_t sync_api_init_local ( void  )

Definition at line 147 of file em_init.c.

◆ term_core()

em_status_t term_core ( em_escope_t  escope)

Definition at line 363 of file em_init.c.

◆ term_extthr()

em_status_t term_extthr ( em_escope_t  escope)

Definition at line 437 of file em_init.c.

Variable Documentation

◆ locm_init_values

const em_locm_t locm_init_values
extern

Definition at line 51 of file em_init.c.