Data Structures | Macros | Typedefs | Functions | Variables
Main

These functions provide general initialization and shut down functions. More...

Data Structures

struct  _Eina_Version
 The version of Eina. More...
 

Macros

#define EINA_VERSION_MAJOR   EFL_VERSION_MAJOR
 Definition for the major version of Eina.
 
#define EINA_VERSION_MINOR   EFL_VERSION_MINOR
 Definition for the minor version of Eina.
 

Typedefs

typedef struct _Eina_Version Eina_Version
 The version of Eina.
 

Functions

EINA_API int eina_init (void)
 Initializes the Eina library. More...
 
EINA_API int eina_shutdown (void)
 Shuts down the Eina library. More...
 
EINA_API int eina_threads_init (void)
 Initializes the mutexes of the Eina library. More...
 
EINA_API int eina_threads_shutdown (void)
 Shuts down mutexes in the Eina library. More...
 
EINA_API Eina_Bool eina_main_loop_is (void)
 Checks if you are calling this function from the same thread Eina was initialized or not. More...
 
EINA_API void eina_main_loop_define (void)
 You should never use this function except if you really really know what your are doing. More...
 

Variables

EINA_API Eina_Versioneina_version
 Eina version (defined at configuration time)
 
EINA_API Eina_Error EINA_ERROR_NOT_IMPLEMENTED
 

Detailed Description

These functions provide general initialization and shut down functions.

Function Documentation

◆ eina_init()

EINA_API int eina_init ( void  )

Initializes the Eina library.

Returns
1 or greater on success, 0 on error.

This function sets up all the eina modules. It returns 0 on failure (that is, when one of the module fails to initialize), otherwise it returns the number of times it has already been called.

When Eina is not used anymore, call eina_shutdown() to shut down the Eina library.

This function is affected by the following environment variables.

Logging environment variables:

  • EINA_LOG_ABORT=1 will cause abort(3) if EINA_LOG_ABORT_LEVEL, which defaults to 0 (critical), is reached.
  • EINA_LOG_ABORT_LEVEL=LEVEL, where level is an integer such as 0 (critical) to 4 (debug). This will cause any messages at that level or lower (i.e.: if 4, then messages at level 0 also apply) to abort(3) the application if EINA_LOG_ABORT=1 was defined.
  • EINA_LOG_BACKTRACE=LEVEL, where level is an integer such as 0 (critical) to 4 (debug). This will cause any messages at that level or lower (i.e.: if 4, then messages at level 0 also apply) to dump a backtrace. Note that if systemd-journal is used, it's going to the journal as well.
  • EINA_LOG_COLOR_DISABLE=[0|1] if 1 it will disable color in log output. If it's 0, it will keep colors. By default it will use colors if it's a TTY, disabling colors if it's printing to a file.
  • EINA_LOG_FILE_DISABLE=[0|1] if 1 it will disable showing the source file name and line that generated the message. If 0, the default, it will show the source file and line.
  • EINA_LOG_FUNCTION_DISABLE=[0|1] if 1 it will disable showing the source function name that generated the message. If 0, the default, it will show the function name.
  • EINA_LOG_LEVEL=LEVEL, where level is an integer such as 0 (critical) to 4 (debug), where the number is the the highest level to print, that is, using level=4 will lead to messages of level 1, 2 and 3 to be displayed as well, but not level
    1. This will control all log domains at once and has lower priority than EINA_LOG_LEVELS, that defines per-domain.
  • EINA_LOG_LEVELS=DOMAIN1:LEVEL1,DOMAIN2:LEVEL2 is a comma separated list of tuples of DOMAIN and LEVEL values separated by a colon. Level is an integer such as 0 (critical) to 4 (debug), where the number is the the highest level to print, that is, using level=4 will lead to messages of level 1, 2 and 3 to be displayed as well, but not level 5. This offers fine grained control, allowing a single domain to be printed at debug (4) while keeping others at error (1) only. For instance EINA_LOG_LEVELS=eina:2,eina_binshare:4 will change eina's general purpose logging domain to warning (2) while will make the specific eina_binshare debug (4).
  • EINA_LOG_LEVELS_GLOB=PATTERN1:LEVEL1,PATTERN2:LEVEL2 is a comma separated list of tuples of domain PATTERN and LEVEL values separated by a colon. PATTERN is a fnmatch(3) pattern that will try to match the domain name. Level is an integer such as 0 (critical) to 4 (debug), where the number is the the highest level to print, that is, using level=4 will lead to messages of level 1, 2 and 3 to be displayed as well, but not level 5. This offers fine grained control, allowing a single domain to be printed at debug (4) while keeping others at error (1) only. For instance EINA_LOG_LEVELS_GLOB=eina*:4 will change all domain names starting with "eina", such as "eina" (general purpose log domain) and "eina_binshare".

Memory allocator environment variables:

  • EINA_MEMPOOL=mempool_allocator will choose another memory allocator to use. Commonly this is given pass_through as the mempool_allocator to allow valgrind and other tools to debug it more easily.
  • EINA_MEMPOOL_PASS=1 has the almost the same effect of EINA_MEMPOOL=pass_through, but if pass_through allocator wasn't built, it will use the original allocator.
  • EINA_MTRACE=1 and MALLOC_TRACE=PATH will use mtrace(3) and store the memory allocation traces to given PATH.

Module loading environment variables:

  • EINA_MODULE_LAZY_LOAD=1 will dlopen(3) with RTLD_LAZY, this results in faster startup since symbols will be resolved when needed, but may omit errors as they will be triggered later on.

Threads environment variables:

  • EINA_DEBUG_THREADS=1 will print out debug information about threads, but requires Eina to be compiled with such feature.

References eina_error_msg_static_register(), EINA_ERROR_NOT_MAIN_LOOP, EINA_FREEQ_DEFAULT, eina_freeq_new(), EINA_LIKELY, EINA_LOG_COLOR_DEFAULT, eina_log_domain_register(), EINA_LOG_ERR, and ERR.

Referenced by ecore_con_init(), ecore_drm2_init(), ecore_drm_init(), ecore_init(), ecore_win32_init(), ecore_wl2_init(), ecore_wl_init(), ector_init(), edje_init(), eet_init(), eeze_init(), efreet_init(), eio_init(), eldbus_init(), elm_quicklaunch_init(), elput_init(), elua_init(), embryo_init(), emile_init(), ethumb_client_init(), and evas_init().

◆ eina_shutdown()

EINA_API int eina_shutdown ( void  )

Shuts down the Eina library.

Returns
0 when all the modules are completely shut down, 1 or greater otherwise.

This function shuts down the Eina library. It returns 0 when it has been called the same number of times than eina_init(). In that case it shuts down all the Eina modules.

Once this function succeeds (that is, 0 is returned), you must not call any of the Eina functions anymore. You must call eina_init() again to use the Eina functions again.

References eina_freeq_free(), eina_freeq_main_get(), EINA_LOG_STATE_SHUTDOWN, EINA_LOG_STATE_START, eina_log_timing(), EINA_UNLIKELY, and ERR.

Referenced by ecore_con_init(), ecore_con_shutdown(), ecore_drm_init(), ecore_win32_init(), ecore_win32_shutdown(), ecore_x_init(), ecore_x_init_from_display(), ector_init(), ector_shutdown(), eet_init(), eet_shutdown(), eeze_init(), eeze_shutdown(), efreet_init(), efreet_shutdown(), eldbus_init(), elua_shutdown(), embryo_init(), embryo_shutdown(), emile_init(), emile_shutdown(), emotion_shutdown(), evas_init(), and evas_shutdown().

◆ eina_threads_init()

EINA_API int eina_threads_init ( void  )

Initializes the mutexes of the Eina library.

Returns
1 or greater on success, 0 on error.

This function sets up all the mutexes in all eina modules. It returns 0 on failure (that is, when one of the module fails to initialize), otherwise it returns the number of times it has already been called.

When the mutexes are not used anymore, call eina_threads_shutdown() to shut down the mutexes.

This function should never be called outside of the main loop.

References EINA_TRUE.

Referenced by ecore_thread_feedback_run(), and ecore_thread_run().

◆ eina_threads_shutdown()

EINA_API int eina_threads_shutdown ( void  )

Shuts down mutexes in the Eina library.

Returns
0 when all mutexes are completely shut down, 1 or greater otherwise.

This function shuts down the mutexes in the Eina library. It returns 0 when it has been called the same number of times than eina_threads_init(). In that case it shut down all the mutexes.

Once this function succeeds (that is, 0 is returned), you must not call any of the Eina functions in a thread anymore. You must call eina_threads_init() again to use the Eina functions in a thread again.

This function should never be called outside of the main loop.

Referenced by ecore_thread_feedback_run(), and ecore_thread_run().

◆ eina_main_loop_is()

EINA_API Eina_Bool eina_main_loop_is ( void  )

Checks if you are calling this function from the same thread Eina was initialized or not.

Returns
EINA_TRUE is the calling function is the same thread, EINA_FALSE otherwise.
Since
1.1.0

Most EFL functions are not thread safe and all the calls need to happen in the main loop. With this call you could know if you can call an EFL function or not.

References EINA_FALSE, and EINA_TRUE.

Referenced by ecore_main_loop_thread_safe_call_async(), ecore_main_loop_thread_safe_call_sync(), ecore_thread_main_loop_begin(), ecore_thread_main_loop_end(), eina_error_get(), and eina_error_set().

◆ eina_main_loop_define()

EINA_API void eina_main_loop_define ( void  )

You should never use this function except if you really really know what your are doing.

Since
1.1.0

If you are reading this documentation, that certainly means you don't know what is the purpose of this call and you should just not use it.

You should never use this function except if you really really know what your are doing.

Referenced by ecore_fork_reset(), ecore_thread_main_loop_begin(), and elm_quicklaunch_fork().