diff options
Diffstat (limited to 'libraries/eina/src/include/eina_lock.h')
-rw-r--r-- | libraries/eina/src/include/eina_lock.h | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/libraries/eina/src/include/eina_lock.h b/libraries/eina/src/include/eina_lock.h deleted file mode 100644 index 16f4314..0000000 --- a/libraries/eina/src/include/eina_lock.h +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
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 | #include "eina_error.h" | ||
25 | |||
26 | /** | ||
27 | * @addtogroup Eina_Tools_Group Tools | ||
28 | * | ||
29 | * @{ | ||
30 | */ | ||
31 | |||
32 | /** | ||
33 | * @defgroup Eina_Lock_Group Lock | ||
34 | * | ||
35 | * @{ | ||
36 | */ | ||
37 | |||
38 | typedef enum | ||
39 | { | ||
40 | EINA_LOCK_FAIL = EINA_FALSE, | ||
41 | EINA_LOCK_SUCCEED = EINA_TRUE, | ||
42 | EINA_LOCK_DEADLOCK | ||
43 | } Eina_Lock_Result; | ||
44 | |||
45 | #ifdef EINA_HAVE_THREADS | ||
46 | # ifdef _WIN32_WCE | ||
47 | # include "eina_inline_lock_wince.x" | ||
48 | # elif defined(_WIN32) | ||
49 | # include "eina_inline_lock_win32.x" | ||
50 | # else | ||
51 | # include "eina_inline_lock_posix.x" | ||
52 | # endif | ||
53 | #else | ||
54 | # include "eina_inline_lock_void.x" | ||
55 | #endif | ||
56 | |||
57 | EAPI extern Eina_Error EINA_ERROR_NOT_MAIN_LOOP; | ||
58 | |||
59 | static inline Eina_Bool eina_lock_new(Eina_Lock *mutex); | ||
60 | static inline void eina_lock_free(Eina_Lock *mutex); | ||
61 | static inline Eina_Lock_Result eina_lock_take(Eina_Lock *mutex); | ||
62 | static inline Eina_Lock_Result eina_lock_take_try(Eina_Lock *mutex); | ||
63 | static inline Eina_Lock_Result eina_lock_release(Eina_Lock *mutex); | ||
64 | static inline void eina_lock_debug(const Eina_Lock *mutex); | ||
65 | |||
66 | static inline Eina_Bool eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex); | ||
67 | static inline void eina_condition_free(Eina_Condition *cond); | ||
68 | static inline Eina_Bool eina_condition_wait(Eina_Condition *cond); | ||
69 | static inline Eina_Bool eina_condition_timedwait(Eina_Condition *cond, double t); | ||
70 | static inline Eina_Bool eina_condition_broadcast(Eina_Condition *cond); | ||
71 | static inline Eina_Bool eina_condition_signal(Eina_Condition *cond); | ||
72 | |||
73 | static inline Eina_Bool eina_rwlock_new(Eina_RWLock *mutex); | ||
74 | static inline void eina_rwlock_free(Eina_RWLock *mutex); | ||
75 | static inline Eina_Lock_Result eina_rwlock_take_read(Eina_RWLock *mutex); | ||
76 | static inline Eina_Lock_Result eina_rwlock_take_write(Eina_RWLock *mutex); | ||
77 | static inline Eina_Lock_Result eina_rwlock_release(Eina_RWLock *mutex); | ||
78 | |||
79 | static inline Eina_Bool eina_tls_new(Eina_TLS *key); | ||
80 | static inline void eina_tls_free(Eina_TLS key); | ||
81 | static inline void *eina_tls_get(Eina_TLS key); | ||
82 | static inline Eina_Bool eina_tls_set(Eina_TLS key, const void *data); | ||
83 | |||
84 | static inline Eina_Bool eina_semaphore_new(Eina_Semaphore *sem, int count_init); | ||
85 | static inline Eina_Bool eina_semaphore_free(Eina_Semaphore *sem); | ||
86 | static inline Eina_Bool eina_semaphore_lock(Eina_Semaphore *sem); | ||
87 | static inline Eina_Bool eina_semaphore_release(Eina_Semaphore *sem, int count_release); | ||
88 | |||
89 | #ifdef EINA_HAVE_DEBUG_THREADS | ||
90 | # define EINA_MAIN_LOOP_CHECK_RETURN_VAL(val) \ | ||
91 | do { \ | ||
92 | if (EINA_UNLIKELY(!eina_main_loop_is())) \ | ||
93 | { \ | ||
94 | eina_error_set(EINA_ERROR_NOT_MAIN_LOOP); \ | ||
95 | EINA_LOG_ERR("You are calling %s from outside" \ | ||
96 | "of the main loop threads in %s at line %i", \ | ||
97 | __FUNCTION__, \ | ||
98 | __FILE__, \ | ||
99 | __LINE__); \ | ||
100 | return val; \ | ||
101 | } \ | ||
102 | } while (0) | ||
103 | # define EINA_MAIN_LOOP_CHECK_RETURN \ | ||
104 | do { \ | ||
105 | if (EINA_UNLIKELY(!eina_main_loop_is())) \ | ||
106 | { \ | ||
107 | eina_error_set(EINA_ERROR_NOT_MAIN_LOOP); \ | ||
108 | EINA_LOG_ERR("You are calling %s from outside" \ | ||
109 | "of the main loop threads in %s at line %i", \ | ||
110 | __FUNCTION__, \ | ||
111 | __FILE__, \ | ||
112 | __LINE__); \ | ||
113 | return ; \ | ||
114 | } \ | ||
115 | } while (0) | ||
116 | #else | ||
117 | # define EINA_MAIN_LOOP_CHECK_RETURN_VAL(val) | ||
118 | # define EINA_MAIN_LOOP_CHECK_RETURN | ||
119 | #endif | ||
120 | |||
121 | /** | ||
122 | * @} | ||
123 | */ | ||
124 | |||
125 | /** | ||
126 | * @} | ||
127 | */ | ||
128 | |||
129 | #endif | ||