Lines 38-63
Link Here
|
38 |
if (did_glib_init) return; |
38 |
if (did_glib_init) return; |
39 |
did_glib_init = TRUE; |
39 |
did_glib_init = TRUE; |
40 |
|
40 |
|
41 |
/* Initialize glib's type system */ |
|
|
42 |
g_type_init(); |
43 |
|
44 |
/* set up libcurl (this must happen before threading |
41 |
/* set up libcurl (this must happen before threading |
45 |
* is initialized) */ |
42 |
* is initialized) */ |
46 |
#ifdef HAVE_LIBCURL |
43 |
#ifdef HAVE_LIBCURL |
47 |
# ifdef G_THREADS_ENABLED |
44 |
# ifdef G_THREADS_ENABLED |
48 |
g_assert(!g_thread_supported()); |
45 |
g_assert(!g_thread_supported()); /* assert threads aren't initialized yet */ |
49 |
# endif |
46 |
# endif |
50 |
g_assert(curl_global_init(CURL_GLOBAL_ALL) == 0); |
47 |
g_assert(curl_global_init(CURL_GLOBAL_ALL) == 0); |
51 |
#endif |
48 |
#endif |
52 |
|
49 |
|
53 |
/* And set up glib's threads */ |
|
|
54 |
#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE) |
55 |
if (g_thread_supported()) { |
56 |
return; |
57 |
} |
58 |
g_thread_init(NULL); |
59 |
#endif |
60 |
|
61 |
/* do a version check */ |
50 |
/* do a version check */ |
62 |
#if GLIB_CHECK_VERSION(2,6,0) |
51 |
#if GLIB_CHECK_VERSION(2,6,0) |
63 |
{ |
52 |
{ |
Lines 71-76
Link Here
|
71 |
} |
60 |
} |
72 |
} |
61 |
} |
73 |
#endif |
62 |
#endif |
|
|
63 |
|
64 |
/* Initialize glib's type system. On glib >= 2.24, this will initialize |
65 |
* threads, so it must be done after curl is initialized. */ |
66 |
g_type_init(); |
67 |
|
68 |
/* And set up glib's threads */ |
69 |
#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE) |
70 |
if (!g_thread_supported()) |
71 |
g_thread_init(NULL); |
72 |
#endif |
74 |
} |
73 |
} |
75 |
|
74 |
|
76 |
typedef enum { |
75 |
typedef enum { |