1 |
#include "config.h"
|
2 |
#ifndef HAVE_API_WIN32_BASE
|
3 |
#define USE_POSIX_THREADS 1
|
4 |
#endif
|
5 |
#if USE_POSIX_THREADS
|
6 |
#include <pthread.h>
|
7 |
#endif
|
8 |
#include "debug.h"
|
9 |
|
10 |
#define g_return_if_fail
|
11 |
|
12 |
|
13 |
#if USE_POSIX_THREADS
|
14 |
# define GMutex pthread_mutex_t
|
15 |
# define g_mutex_new g_mutex_new_navit
|
16 |
# define g_mutex_lock(lock) ((lock == NULL) ? 0 : pthread_mutex_lock(lock))
|
17 |
# define g_mutex_unlock(lock) ((lock == NULL) ? 0 : pthread_mutex_unlock(lock))
|
18 |
# define g_mutex_trylock(lock) (((lock == NULL) ? 0 : pthread_mutex_trylock(lock)) == 0)
|
19 |
# define GPrivate pthread_key_t
|
20 |
# define g_private_new(xd) g_private_new_navit()
|
21 |
# define g_private_get(xd) pthread_getspecific(xd)
|
22 |
# define g_private_set(a,b) pthread_setspecific(a, b)
|
23 |
#else
|
24 |
# if HAVE_API_WIN32_BASE
|
25 |
# define GMutex CRITICAL_SECTION
|
26 |
# define g_mutex_new g_mutex_new_navit
|
27 |
# define g_mutex_lock(lock) (EnterCriticalSection(lock))
|
28 |
# define g_mutex_unlock(lock) (LeaveCriticalSection(lock))
|
29 |
# define g_mutex_trylock(lock) (TryEnterCriticalSection(lock))
|
30 |
# define GPrivate int
|
31 |
# define g_private_new(xd) g_private_new_navit()
|
32 |
# define g_private_get(xd) TlsGetValue(xd)
|
33 |
# define g_private_set(a,b) TlsSetValue(a, b)
|
34 |
# endif
|
35 |
#endif
|
36 |
|
37 |
char* g_convert (const char *str,
|
38 |
int len,
|
39 |
const char *to_codeset,
|
40 |
const char *from_codeset,
|
41 |
int *bytes_read,
|
42 |
int *bytes_written,
|
43 |
void **error);
|
44 |
#define G_LOCK_DEFINE_STATIC(name) //void
|
45 |
#define G_LOCK(name) //void //g_mutex_lock (&G_LOCK_NAME (name))
|
46 |
#define G_UNLOCK(name) //void //g_mutex_unlock (&G_LOCK_NAME (name))
|
47 |
|
48 |
#define g_thread_supported() TRUE
|
49 |
|
50 |
#define g_assert(expr) dbg_assert (expr)
|