EFL 1.7 svn doobies
[profile/ivi/eina.git] / src / include / eina_main.h
1 /* EINA - EFL data type library
2  * Copyright (C) 2008 Cedric Bail
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library;
16  * if not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef EINA_MAIN_H_
20 #define EINA_MAIN_H_
21
22 #include "eina_types.h"
23
24 /**
25  * @addtogroup Eina_Main_Group Main
26  *
27  * @brief These functions provide general initialisation and shut down
28  * functions.
29  */
30
31 /**
32  * @addtogroup Eina_Core_Group Core
33  *
34  * @{
35  */
36
37 /**
38  * @defgroup Eina_Main_Group Main
39  *
40  * @{
41  */
42
43 /**
44  * @def EINA_VERSION_MAJOR
45  * @brief Major version of Eina
46  */
47 #define EINA_VERSION_MAJOR 1
48
49 /**
50  * @def EINA_VERSION_MINOR
51  * @brief Minor version of Eina
52  */
53 #define EINA_VERSION_MINOR 7
54
55 /**
56  * @typedef Eina_Version
57  * The version of Eina.
58  */
59 typedef struct _Eina_Version
60 {
61    int major;    /**< Major component of the version */
62    int minor;    /**< Minor component of the version */
63    int micro;    /**< Micro component of the version */
64    int revision; /**< Revision component of the version */
65 } Eina_Version;
66
67 EAPI extern Eina_Version *eina_version;
68
69 /**
70  * @brief Initialize the Eina library.
71  *
72  * @return 1 or greater on success, 0 on error.
73  *
74  * This function sets up all the eina modules. It returns 0 on
75  * failure (that is, when one of the module fails to initialize),
76  * otherwise it returns the number of times it has already been
77  * called.
78  *
79  * When Eina is not used anymore, call eina_shutdown() to shut down
80  * the Eina library.
81  */
82 EAPI int eina_init(void);
83
84 /**
85  * @brief Shut down the Eina library.
86  *
87  * @return 0 when all the modules are completely shut down, 1 or
88  * greater otherwise.
89  *
90  * This function shuts down the Eina library. It returns 0 when it has
91  * been called the same number of times than eina_init(). In that case
92  * it shut down all the Eina modules.
93  *
94  * Once this function succeeds (that is, @c 0 is returned), you must
95  * not call any of the Eina function anymore. You must call
96  * eina_init() again to use the Eina functions again.
97  */
98 EAPI int eina_shutdown(void);
99
100 /**
101  * @brief Initialize the mutexes of the Eina library.
102  *
103  * @return 1 or greater on success, 0 on error.
104  *
105  * This function sets up all the mutexes in all eina modules. It returns 0 on
106  * failure (that is, when one of the module fails to initialize),
107  * otherwise it returns the number of times it has already been
108  * called.
109  *
110  * When the mutexes are not used anymore, call eina_threads_shutdown() to shut down
111  * the mutexes.
112  *
113  * This function should never be called outside of the main loop.
114  */
115 EAPI int eina_threads_init(void);
116
117 /**
118  * @brief Shut down mutexes in the Eina library.
119  *
120  * @return 0 when all mutexes are completely shut down, 1 or
121  * greater otherwise.
122  *
123  * This function shuts down the mutexes in the Eina library. It returns 0 when it has
124  * been called the same number of times than eina_threads_init(). In that case
125  * it shut down all the mutexes.
126  *
127  * Once this function succeeds (that is, @c 0 is returned), you must
128  * not call any of the Eina function in a thread anymore. You must call
129  * eina_threads_init() again to use the Eina functions in a thread again.
130  *
131  * This function should never be called outside of the main loop.
132  */
133 EAPI int eina_threads_shutdown(void);
134
135 /**
136  * @brief Check if you are calling this function from the same thread Eina was initialized or not
137  *
138  * @return #EINA_TRUE is the calling function is the same thread, #EINA_FALSE otherwise.
139  *
140  * @since 1.1.0
141  *
142  * Most EFL function are not thread safe and all the call need to happen in
143  * the main loop. With this call you could know if you can call an EFL
144  * function or not.
145  */
146 EAPI Eina_Bool eina_main_loop_is(void);
147
148 /**
149  * @brief You should never use that function excpet if you really really know what your are doing.
150  * @since 1.1.0
151  *
152  * If you are reading this documentation, that certainly means you don't know what is the purpose of
153  * this call and you should just not use it.
154  */
155 EAPI void eina_main_loop_define(void);
156
157 /**
158  * @}
159  */
160
161 /**
162  * @}
163  */
164
165 #endif /* EINA_MAIN_H_ */