769a5cbcb736f1e73ffabf9a602aad7a09f9a62e
[profile/ivi/eina.git] / src / include / eina_lock.h
1 /* EINA - EFL data type library
2  * Copyright (C) 2011 Vincent Torri
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_LOCK_H_
20 #define EINA_LOCK_H_
21
22 #include "eina_config.h"
23 #include "eina_types.h"
24
25 /**
26  * @addtogroup Eina_Tools_Group Tools
27  *
28  * @{
29  */
30
31 /**
32  * @defgroup Eina_File_Group File
33  *
34  * @{
35  */
36
37 typedef enum
38 {
39    EINA_LOCK_FAIL     = EINA_FALSE,
40    EINA_LOCK_SUCCEED  = EINA_TRUE,
41    EINA_LOCK_DEADLOCK
42 } Eina_Lock_Result;
43
44 #ifdef EINA_HAVE_THREADS
45 # ifdef _WIN32_WCE
46 #  include "eina_inline_lock_wince.x"
47 # elif defined(_WIN32)
48 #  include "eina_inline_lock_win32.x"
49 # else
50 #  include "eina_inline_lock_posix.x"
51 # endif
52 #else
53 # include "eina_inline_lock_void.x"
54 #endif
55
56 static inline Eina_Bool eina_lock_new(Eina_Lock *mutex);
57 static inline void eina_lock_free(Eina_Lock *mutex);
58 static inline Eina_Lock_Result eina_lock_take(Eina_Lock *mutex);
59 static inline Eina_Lock_Result eina_lock_take_try(Eina_Lock *mutex);
60 static inline Eina_Lock_Result eina_lock_release(Eina_Lock *mutex);
61 static inline void eina_lock_debug(Eina_Lock *mutex);
62
63 /**
64  * @}
65  */
66
67 /**
68  * @}
69  */
70
71 #endif