diff options
| author | David Bremner <david@tethera.net> | 2021-05-09 17:33:48 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-05-13 22:21:57 -0300 |
| commit | 8410be8e0867820c9814d06b49ff6da822d384a3 (patch) | |
| tree | 7e5f132d32eba50b3688d37d96a9f685e1216209 /lib/open.cc | |
| parent | a34d7b41444ad2fb50cc7def25659c88d439780a (diff) | |
lib: make glib initialization thread-safe
In principle this could be done without depending on C++11 features,
but these features should be available since gcc 4.8.1, and this
localized usage is easy to replace if it turns out to be problematic
for portability.
Diffstat (limited to 'lib/open.cc')
| -rw-r--r-- | lib/open.cc | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/open.cc b/lib/open.cc index 1e9c86fe..84b2d6b1 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -308,24 +308,6 @@ _set_database_path (notmuch_database_t *notmuch, } static void -_init_libs () -{ - - static int initialized = 0; - - /* Initialize the GLib type system and threads */ -#if ! GLIB_CHECK_VERSION (2, 35, 1) - g_type_init (); -#endif - - /* Initialize gmime */ - if (! initialized) { - g_mime_init (); - initialized = 1; - } -} - -static void _load_database_state (notmuch_database_t *notmuch) { std::string last_thread_id; @@ -498,7 +480,7 @@ notmuch_database_open_with_config (const char *database_path, GKeyFile *key_file = NULL; bool split = false; - _init_libs (); + _notmuch_init (); notmuch = _alloc_notmuch (); if (! notmuch) { @@ -595,7 +577,7 @@ notmuch_database_create_with_config (const char *database_path, int err; bool split = false; - _init_libs (); + _notmuch_init (); notmuch = _alloc_notmuch (); if (! notmuch) { @@ -791,7 +773,7 @@ notmuch_database_load_config (const char *database_path, GKeyFile *key_file = NULL; bool split = false; - _init_libs (); + _notmuch_init (); notmuch = _alloc_notmuch (); if (! notmuch) { |
