aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/include/eina_inline_lock_wince.x
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/include/eina_inline_lock_wince.x
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/eina/src/include/eina_inline_lock_wince.x')
-rw-r--r--libraries/eina/src/include/eina_inline_lock_wince.x178
1 files changed, 178 insertions, 0 deletions
diff --git a/libraries/eina/src/include/eina_inline_lock_wince.x b/libraries/eina/src/include/eina_inline_lock_wince.x
new file mode 100644
index 0000000..965d475
--- /dev/null
+++ b/libraries/eina/src/include/eina_inline_lock_wince.x
@@ -0,0 +1,178 @@
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_INLINE_LOCK_WIN32_X_
20#define EINA_INLINE_LOCK_WIN32_X_
21
22#include <windows.h>
23
24EAPI extern Eina_Bool _threads_activated;
25
26typedef HANDLE Eina_Lock;
27typedef Eina_Lock Eina_RWLock;
28typedef DWORD Eina_TLS;
29
30static inline Eina_Bool
31eina_lock_new(Eina_Lock *mutex)
32{
33 Eina_Lock m;
34
35 m = CreateMutex(NULL, FALSE, NULL);
36 if (m) *mutex = m;
37 return (m != NULL);
38}
39
40static inline void
41eina_lock_free(Eina_Lock *mutex)
42{
43 CloseHandle(*mutex);
44}
45
46static inline Eina_Lock_Result
47eina_lock_take(Eina_Lock *mutex)
48{
49 DWORD res;
50
51#ifdef EINA_HAVE_ON_OFF_THREADS
52 if (!_eina_threads_activated) return EINA_LOCK_FAIL;
53#endif
54
55 res = WaitForSingleObject(*mutex, INFINITE);
56 if ((res == WAIT_ABANDONED) || (res == WAIT_FAILED))
57 return EINA_LOCK_FAIL;
58
59 return EINA_LOCK_SUCCEED;
60}
61
62static inline Eina_Lock_Result
63eina_lock_take_try(Eina_Lock *mutex)
64{
65 return eina_lock_take(*mutex);
66}
67
68static inline Eina_Lock_Result
69eina_lock_release(Eina_Lock *mutex)
70{
71#ifdef EINA_HAVE_ON_OFF_THREADS
72 if (!_eina_threads_activated) return ;
73#endif
74
75 return ReleaseMutex(*mutex) ? EINA_LOCK_SUCCEED : EINA_LOCK_FAIL;
76}
77
78static inline void
79eina_lock_debug(const Eina_Lock *mutex)
80{
81}
82
83static inline Eina_Bool
84eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex)
85{
86 return EINA_FALSE;
87}
88
89static inline void
90eina_condition_free(Eina_Condition *cond)
91{
92}
93
94static inline Eina_Bool
95eina_condition_wait(Eina_Condition *cond)
96{
97 return EINA_FALSE;
98}
99
100static inline Eina_Bool
101eina_condition_timedwait(Eina_Condition *cond, double t)
102{
103 return EINA_FALSE;
104}
105
106static inline Eina_Bool
107eina_condition_broadcast(Eina_Condition *cond)
108{
109 return EINA_FALSE;
110}
111
112static inline Eina_Bool
113eina_condition_signal(Eina_Condition *cond)
114{
115 return EINA_FALSE;
116}
117
118static inline Eina_Bool
119eina_rwlock_new(Eina_RWLock *mutex)
120{
121 return eina_lock_new(mutex);
122}
123
124static inline void
125eina_rwlock_free(Eina_RWLock *mutex)
126{
127 return eina_lock_free(mutex);
128}
129
130static inline Eina_Lock_Result
131eina_rwlock_take_read(Eina_RWLock *mutex)
132{
133 return eina_lock_take(mutex);
134}
135
136static inline Eina_Lock_Result
137eina_rwlock_take_write(Eina_RWLock *mutex)
138{
139 return eina_lock_take(mutex);
140}
141
142static inline Eina_Lock_Result
143eina_rwlock_release(Eina_RWLock *mutex)
144{
145 return eina_lock_release(mutex);
146}
147
148static inline Eina_Bool
149eina_tls_new(Eina_TLS *key)
150{
151 if (TlsAlloc() == TLS_OUT_OF_INDEXES)
152 return EINA_FALSE;
153 return EINA_TRUE;
154}
155
156static inline void
157eina_tls_free(Eina_TLS key)
158{
159 TlsFree(key);
160}
161
162static inline void *
163eina_tls_get(Eina_TLS key)
164{
165 return (void*)TlsGetValue(key);
166}
167
168static inline Eina_Bool
169eina_tls_set(Eina_TLS key, const void *data)
170{
171 if (TlsSetValue(key, (LPVOID)data) == 0)
172 return EINA_FALSE;
173 return EINA_TRUE;
174}
175
176
177
178#endif