1 #ifndef _RCC_EXTERNAL_COMPAT_H
2 #define _RCC_EXTERNAL_COMPAT_H
3 
4 #include <glib.h>
5 
6 # if GLIB_CHECK_VERSION(2,32,0)
g_mutex_new_32()7 inline static GMutex *g_mutex_new_32() {
8     GMutex *res = malloc(sizeof(GMutex));
9     if (!res) return res;
10     g_mutex_init(res);
11     return res;
12 }
13 
g_cond_new_32()14 inline static GCond *g_cond_new_32() {
15     GCond *res = malloc(sizeof(GCond));
16     if (!res) return res;
17     g_cond_init(res);
18     return res;
19 }
20 
g_thread_create_32(GThreadFunc func,gpointer data,int joinable)21 inline static GThread *g_thread_create_32(GThreadFunc func, gpointer data, int joinable) {
22     GThread *res = g_thread_new(NULL, func, data);
23     if ((res)&&(!joinable)) g_thread_unref(res);
24     return res;
25 }
26 
27 # define g_thread_create_compat(func, data, joinable) g_thread_create_32(func, data, joinable)
28 # define g_mutex_new_compat() g_mutex_new_32()
29 # define g_cond_new_compat() g_cond_new_32()
30 # define g_mutex_free_compat(mutex) free(mutex)
31 # define g_cond_free_compat(mutex) free(mutex)
32 #else
33 # define g_thread_create_compat(func, data, joinable) g_thread_create(func, data, joinable, NULL)
34 # define g_mutex_new_compat() g_mutex_new()
35 # define g_cond_new_compat() g_cond_new()
36 # define g_mutex_free_compat(mutex) g_mutex_free(mutex)
37 # define g_cond_free_compat(mutex) g_cond_free(mutex)
38 # endif
39 
40 
41 
42 #endif /*  _RCC_EXTERNAL_COMPAT_H */
43