[yelp] Updates for some deprecated thread APIs
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Updates for some deprecated thread APIs
- Date: Sun, 18 Aug 2013 21:48:46 +0000 (UTC)
commit a25ade835a3b706749e7e324e85120c749999372
Author: Shaun McCance <shaunm gnome org>
Date: Sun Aug 18 17:40:49 2013 -0400
Updates for some deprecated thread APIs
libyelp/yelp-docbook-document.c | 36 +++++-----
libyelp/yelp-document.c | 146 +++++++++++++++++++-------------------
libyelp/yelp-help-list.c | 19 +++---
libyelp/yelp-info-document.c | 21 +++---
libyelp/yelp-mallard-document.c | 37 +++++-----
libyelp/yelp-man-document.c | 21 +++---
libyelp/yelp-settings.c | 52 +++++++-------
libyelp/yelp-sqlite-storage.c | 23 +++---
libyelp/yelp-storage.c | 6 +-
libyelp/yelp-transform.c | 45 ++++++------
libyelp/yelp-uri.c | 5 +-
11 files changed, 210 insertions(+), 201 deletions(-)
---
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
index b7e3a98..48dc632 100644
--- a/libyelp/yelp-docbook-document.c
+++ b/libyelp/yelp-docbook-document.c
@@ -103,7 +103,7 @@ struct _YelpDocbookDocumentPrivate {
DocbookState state;
- GMutex *mutex;
+ GMutex mutex;
GThread *thread;
GThread *index;
@@ -169,7 +169,7 @@ yelp_docbook_document_init (YelpDocbookDocument *docbook)
priv->state = DOCBOOK_STATE_BLANK;
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
}
static void
@@ -202,7 +202,7 @@ yelp_docbook_document_finalize (GObject *object)
g_free (priv->cur_prev_id);
g_free (priv->root_id);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
G_OBJECT_CLASS (yelp_docbook_document_parent_class)->finalize (object);
}
@@ -263,15 +263,16 @@ docbook_request_page (YelpDocument *document,
return handled;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
switch (priv->state) {
case DOCBOOK_STATE_BLANK:
priv->state = DOCBOOK_STATE_PARSING;
priv->process_running = TRUE;
g_object_ref (document);
- priv->thread = g_thread_create ((GThreadFunc) docbook_process,
- document, FALSE, NULL);
+ priv->thread = g_thread_new ("docbook-page",
+ (GThreadFunc) docbook_process,
+ document);
break;
case DOCBOOK_STATE_PARSING:
break;
@@ -289,7 +290,7 @@ docbook_request_page (YelpDocument *document,
break;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return FALSE;
}
@@ -361,7 +362,7 @@ docbook_process (YelpDocbookDocument *docbook)
goto done;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (!xmlStrcmp (xmlDocGetRootElement (xmldoc)->name, BAD_CAST "book"))
priv->max_depth = 2;
else
@@ -392,20 +393,20 @@ docbook_process (YelpDocbookDocument *docbook)
xmlNewProp (priv->xmlcur, BAD_CAST "id", BAD_CAST "//index");
}
yelp_document_set_root_id (document, priv->root_id, priv->root_id);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->state == DOCBOOK_STATE_STOP) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
goto done;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
docbook_walk (docbook);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->state == DOCBOOK_STATE_STOP) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
goto done;
}
@@ -436,7 +437,7 @@ docbook_process (YelpDocbookDocument *docbook)
NULL,
(const gchar * const *) params);
g_strfreev (params);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
done:
g_free (filepath);
@@ -1048,7 +1049,8 @@ docbook_index (YelpDocument *document)
priv = GET_PRIV (document);
g_object_ref (document);
- priv->index = g_thread_create ((GThreadFunc) docbook_index_threaded,
- document, FALSE, NULL);
+ priv->index = g_thread_new ("docbook-index",
+ (GThreadFunc) docbook_index_threaded,
+ document);
priv->index_running = TRUE;
}
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c
index 8794682..e686bb6 100644
--- a/libyelp/yelp-document.c
+++ b/libyelp/yelp-document.c
@@ -66,7 +66,7 @@ struct _Hash {
};
struct _YelpDocumentPriv {
- GMutex *mutex;
+ GMutex mutex;
GSList *reqs_all; /* Holds canonical refs, only free from here */
Hash *reqs_by_page_id; /* Indexed by page ID, contains GSList */
@@ -153,7 +153,7 @@ static void request_free (Request *request);
static const gchar * str_ref (const gchar *str);
static void str_unref (const gchar *str);
-GStaticMutex str_mutex = G_STATIC_MUTEX_INIT;
+static GMutex str_mutex;
GHashTable *str_refs = NULL;
/******************************************************************************/
@@ -290,7 +290,7 @@ yelp_document_init (YelpDocument *document)
document->priv = priv = GET_PRIV (document);
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
priv->reqs_by_page_id = hash_new ((GDestroyNotify) g_slist_free);
priv->reqs_all = NULL;
@@ -358,7 +358,7 @@ yelp_document_finalize (GObject *object)
g_hash_table_destroy (document->priv->core_ids);
- g_mutex_free (document->priv->mutex);
+ g_mutex_clear (&document->priv->mutex);
G_OBJECT_CLASS (yelp_document_parent_class)->finalize (object);
}
@@ -420,7 +420,7 @@ yelp_document_list_page_ids (YelpDocument *document)
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
lst = g_hash_table_get_keys (document->priv->core_ids);
ret = g_new0 (gchar *, g_list_length (lst) + 1);
@@ -431,7 +431,7 @@ yelp_document_list_page_ids (YelpDocument *document)
}
g_list_free (lst);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -447,12 +447,12 @@ yelp_document_get_page_id (YelpDocument *document,
if (id != NULL && g_str_has_prefix (id, "search="))
return g_strdup (id);
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
ret = hash_lookup (document->priv->page_ids, id);
if (ret)
ret = g_strdup (ret);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -464,7 +464,7 @@ yelp_document_set_page_id (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->page_ids, id, g_strdup (page_id));
@@ -491,7 +491,7 @@ yelp_document_set_page_id (YelpDocument *document,
}
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -502,7 +502,7 @@ yelp_document_get_root_id (YelpDocument *document,
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
if (page_id != NULL && g_str_has_prefix (page_id, "search="))
real = hash_lookup (document->priv->page_ids, NULL);
else
@@ -512,7 +512,7 @@ yelp_document_get_root_id (YelpDocument *document,
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -524,9 +524,9 @@ yelp_document_set_root_id (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->root_ids, page_id, g_strdup (root_id));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -537,14 +537,14 @@ yelp_document_get_prev_id (YelpDocument *document,
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->prev_ids, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -556,9 +556,9 @@ yelp_document_set_prev_id (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->prev_ids, page_id, g_strdup (prev_id));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -569,14 +569,14 @@ yelp_document_get_next_id (YelpDocument *document,
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->next_ids, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -588,9 +588,9 @@ yelp_document_set_next_id (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->next_ids, page_id, g_strdup (next_id));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -601,14 +601,14 @@ yelp_document_get_up_id (YelpDocument *document,
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->up_ids, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -620,9 +620,9 @@ yelp_document_set_up_id (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->up_ids, page_id, g_strdup (up_id));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -633,7 +633,7 @@ yelp_document_get_root_title (YelpDocument *document,
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
if (page_id != NULL && g_str_has_prefix (page_id, "search=")) {
ret = yelp_storage_get_root_title (yelp_storage_get_default (),
document->priv->doc_uri);
@@ -650,7 +650,7 @@ yelp_document_get_root_title (YelpDocument *document,
}
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -668,14 +668,14 @@ yelp_document_get_page_title (YelpDocument *document,
return ret;
}
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->titles, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -687,9 +687,9 @@ yelp_document_set_page_title (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->titles, page_id, g_strdup (title));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -703,14 +703,14 @@ yelp_document_get_page_desc (YelpDocument *document,
if (page_id != NULL && g_str_has_prefix (page_id, "search="))
return yelp_document_get_root_title (document, page_id);
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->descs, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -722,9 +722,9 @@ yelp_document_set_page_desc (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->descs, page_id, g_strdup (desc));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -738,14 +738,14 @@ yelp_document_get_page_icon (YelpDocument *document,
if (page_id != NULL && g_str_has_prefix (page_id, "search="))
return g_strdup ("yelp-page-search-symbolic");
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->icons, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
if (ret == NULL)
ret = g_strdup ("yelp-page-symbolic");
@@ -760,15 +760,15 @@ yelp_document_set_page_icon (YelpDocument *document,
{
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->icons, page_id, g_strdup (icon));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
static void
document_indexed (YelpDocument *document)
{
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
while (document->priv->reqs_search != NULL) {
Request *request = (Request *) document->priv->reqs_search->data;
request->idle_funcs++;
@@ -777,7 +777,7 @@ document_indexed (YelpDocument *document)
document->priv->reqs_search = g_slist_delete_link (document->priv->reqs_search,
document->priv->reqs_search);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
/******************************************************************************/
@@ -829,7 +829,7 @@ document_request_page (YelpDocument *document,
request->user_data = user_data;
request->idle_funcs = 0;
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
if (g_str_has_prefix (page_id, "search=")) {
document->priv->reqs_search = g_slist_prepend (document->priv->reqs_search, request);
@@ -837,7 +837,7 @@ document_request_page (YelpDocument *document,
g_idle_add ((GSourceFunc) document_indexed, document);
else
yelp_document_index (document);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return TRUE;
}
@@ -859,7 +859,7 @@ document_request_page (YelpDocument *document,
ret = TRUE;
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -867,7 +867,7 @@ document_request_page (YelpDocument *document,
void
yelp_document_clear_contents (YelpDocument *document)
{
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
if (document->priv->contents->null) {
str_unref (document->priv->contents->null);
@@ -875,7 +875,7 @@ yelp_document_clear_contents (YelpDocument *document)
}
g_hash_table_remove_all (document->priv->contents->hash);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar **
@@ -885,7 +885,7 @@ yelp_document_get_requests (YelpDocument *document)
gchar **ret;
gint i;
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
reqs = g_hash_table_get_keys (document->priv->reqs_by_page_id->hash);
ret = g_new0 (gchar*, g_list_length (reqs) + 1);
@@ -894,7 +894,7 @@ yelp_document_get_requests (YelpDocument *document)
}
g_list_free (reqs);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -917,7 +917,7 @@ document_read_contents (YelpDocument *document,
{
gchar *real, *str, **colors;
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
if (page_id != NULL && g_str_has_prefix (page_id, "search=")) {
gchar *tmp, *tmp2, *txt;
@@ -986,7 +986,7 @@ document_read_contents (YelpDocument *document,
str = hash_lookup (document->priv->contents, real);
if (str) {
str_ref (str);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return (const gchar *) str;
}
@@ -1036,7 +1036,7 @@ document_read_contents (YelpDocument *document,
hash_replace (document->priv->contents, page_id, g_string_free (ret, FALSE));
str = hash_lookup (document->priv->contents, page_id);
str_ref (str);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return (const gchar *) str;
}
@@ -1045,7 +1045,7 @@ document_read_contents (YelpDocument *document,
if (str)
str_ref (str);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return (const gchar *) str;
}
@@ -1078,7 +1078,7 @@ yelp_document_give_contents (YelpDocument *document,
debug_print (DB_FUNCTION, "entering\n");
debug_print (DB_ARG, " page_id = \"%s\"\n", page_id);
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
hash_replace (document->priv->contents,
page_id,
@@ -1088,7 +1088,7 @@ yelp_document_give_contents (YelpDocument *document,
page_id,
g_strdup (mime));
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
gchar *
@@ -1107,14 +1107,14 @@ document_get_mime_type (YelpDocument *document,
{
gchar *real, *ret = NULL;
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
real = hash_lookup (document->priv->page_ids, page_id);
if (real) {
ret = hash_lookup (document->priv->mime_types, real);
if (ret)
ret = g_strdup (ret);
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
return ret;
}
@@ -1148,7 +1148,7 @@ yelp_document_signal (YelpDocument *document,
g_return_if_fail (YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
reqs = hash_lookup (document->priv->reqs_by_page_id, page_id);
for (cur = reqs; cur != NULL; cur = cur->next) {
@@ -1174,7 +1174,7 @@ yelp_document_signal (YelpDocument *document,
}
}
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
static gboolean
@@ -1184,7 +1184,7 @@ yelp_document_error_pending_idle (YelpDocument *document)
GSList *cur;
Request *request;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->reqs_pending) {
for (cur = priv->reqs_pending; cur; cur = cur->next) {
@@ -1198,7 +1198,7 @@ yelp_document_error_pending_idle (YelpDocument *document)
priv->reqs_pending = NULL;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
g_object_unref (document);
return FALSE;
@@ -1319,7 +1319,7 @@ request_cancel (GCancellable *cancellable, Request *request)
g_assert (document != NULL && YELP_IS_DOCUMENT (document));
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
document->priv->reqs_pending = g_slist_remove (document->priv->reqs_pending,
(gconstpointer) request);
@@ -1343,7 +1343,7 @@ request_cancel (GCancellable *cancellable, Request *request)
}
request_try_free (request);
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
}
static gboolean
@@ -1364,7 +1364,7 @@ request_idle_contents (Request *request)
document = g_object_ref (request->document);
priv = GET_PRIV (document);
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
priv->reqs_pending = g_slist_remove (priv->reqs_pending, request);
@@ -1372,7 +1372,7 @@ request_idle_contents (Request *request)
user_data = request->user_data;
request->idle_funcs--;
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
if (callback)
callback (document, YELP_DOCUMENT_SIGNAL_CONTENTS, user_data, NULL);
@@ -1397,13 +1397,13 @@ request_idle_info (Request *request)
document = g_object_ref (request->document);
- g_mutex_lock (document->priv->mutex);
+ g_mutex_lock (&document->priv->mutex);
callback = request->callback;
user_data = request->user_data;
request->idle_funcs--;
- g_mutex_unlock (document->priv->mutex);
+ g_mutex_unlock (&document->priv->mutex);
if (callback)
callback (document, YELP_DOCUMENT_SIGNAL_INFO, user_data, NULL);
@@ -1431,7 +1431,7 @@ request_idle_error (Request *request)
document = g_object_ref (request->document);
priv = GET_PRIV (document);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (request->error) {
callback = request->callback;
@@ -1441,7 +1441,7 @@ request_idle_error (Request *request)
}
request->idle_funcs--;
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
if (callback)
callback (document,
@@ -1489,7 +1489,7 @@ str_ref (const gchar *str)
gpointer p;
guint i;
- g_static_mutex_lock (&str_mutex);
+ g_mutex_lock (&str_mutex);
if (str_refs == NULL)
str_refs = g_hash_table_new (g_direct_hash, g_direct_equal);
p = g_hash_table_lookup (str_refs, str);
@@ -1499,7 +1499,7 @@ str_ref (const gchar *str)
p = GUINT_TO_POINTER (i);
g_hash_table_insert (str_refs, (gpointer) str, p);
- g_static_mutex_unlock (&str_mutex);
+ g_mutex_unlock (&str_mutex);
return str;
}
@@ -1510,7 +1510,7 @@ str_unref (const gchar *str)
gpointer p;
guint i;
- g_static_mutex_lock (&str_mutex);
+ g_mutex_lock (&str_mutex);
p = g_hash_table_lookup (str_refs, str);
i = GPOINTER_TO_UINT (p);
@@ -1525,5 +1525,5 @@ str_unref (const gchar *str)
g_free ((gchar *) str);
}
- g_static_mutex_unlock (&str_mutex);
+ g_mutex_unlock (&str_mutex);
}
diff --git a/libyelp/yelp-help-list.c b/libyelp/yelp-help-list.c
index ca2afa8..5bb623e 100644
--- a/libyelp/yelp-help-list.c
+++ b/libyelp/yelp-help-list.c
@@ -92,7 +92,7 @@ G_DEFINE_TYPE (YelpHelpList, yelp_help_list, YELP_TYPE_DOCUMENT);
typedef struct _YelpHelpListPrivate YelpHelpListPrivate;
struct _YelpHelpListPrivate {
- GMutex *mutex;
+ GMutex mutex;
GThread *thread;
gboolean process_running;
@@ -126,7 +126,7 @@ yelp_help_list_init (YelpHelpList *list)
{
YelpHelpListPrivate *priv = GET_PRIV (list);
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
priv->entries = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify) help_list_entry_free);
@@ -157,7 +157,7 @@ yelp_help_list_finalize (GObject *object)
YelpHelpListPrivate *priv = GET_PRIV (object);
g_hash_table_destroy (priv->entries);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
if (priv->get_docbook_title)
xmlXPathFreeCompExpr (priv->get_docbook_title);
@@ -200,7 +200,7 @@ help_list_request_page (YelpDocument *document,
return TRUE;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->process_ran) {
help_list_handle_page ((YelpHelpList *) document, page_id);
return TRUE;
@@ -209,11 +209,12 @@ help_list_request_page (YelpDocument *document,
if (!priv->process_running) {
priv->process_running = TRUE;
g_object_ref (document);
- priv->thread = g_thread_create ((GThreadFunc) help_list_think,
- document, FALSE, NULL);
+ priv->thread = g_thread_new ("helplist-page",
+ (GThreadFunc) help_list_think,
+ document);
}
priv->pending = g_slist_prepend (priv->pending, g_strdup (page_id));
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return TRUE;
}
@@ -425,7 +426,7 @@ help_list_think (YelpHelpList *list)
}
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
priv->process_running = FALSE;
priv->process_ran = TRUE;
while (priv->pending) {
@@ -434,7 +435,7 @@ help_list_think (YelpHelpList *list)
g_free (page_id);
priv->pending = g_slist_delete_link (priv->pending, priv->pending);
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
g_object_unref (list);
}
diff --git a/libyelp/yelp-info-document.c b/libyelp/yelp-info-document.c
index 136b274..7f3c080 100644
--- a/libyelp/yelp-info-document.c
+++ b/libyelp/yelp-info-document.c
@@ -51,7 +51,7 @@ struct _YelpInfoDocumentPrivate {
YelpUri *uri;
InfoState state;
- GMutex *mutex;
+ GMutex mutex;
GThread *thread;
xmlDocPtr xmldoc;
@@ -125,7 +125,7 @@ yelp_info_document_init (YelpInfoDocument *info)
priv->state = INFO_STATE_BLANK;
priv->xmldoc = NULL;
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
}
static void
@@ -162,7 +162,7 @@ yelp_info_document_finalize (GObject *object)
g_free (priv->root_id);
g_free (priv->visit_prev_id);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
G_OBJECT_CLASS (yelp_info_document_parent_class)->finalize (object);
}
@@ -219,15 +219,16 @@ info_request_page (YelpDocument *document,
return TRUE;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
switch (priv->state) {
case INFO_STATE_BLANK:
priv->state = INFO_STATE_PARSING;
priv->process_running = TRUE;
g_object_ref (document);
- priv->thread = g_thread_create ((GThreadFunc) info_document_process,
- document, FALSE, NULL);
+ priv->thread = g_thread_new ("info-page",
+ (GThreadFunc) info_document_process,
+ document);
break;
case INFO_STATE_PARSING:
break;
@@ -245,7 +246,7 @@ info_request_page (YelpDocument *document,
break;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return TRUE;
}
@@ -401,9 +402,9 @@ info_document_process (YelpInfoDocument *info)
goto done;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->state == INFO_STATE_STOP) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
goto done;
}
@@ -429,7 +430,7 @@ info_document_process (YelpInfoDocument *info)
NULL,
(const gchar * const *) params);
g_strfreev (params);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
done:
g_free (filepath);
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index f73780b..ca9e258 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -123,7 +123,7 @@ struct _YelpMallardDocumentPrivate {
YelpUri *uri;
MallardState state;
- GMutex *mutex;
+ GMutex mutex;
GThread *thread;
gboolean thread_running;
GThread *index;
@@ -162,7 +162,7 @@ yelp_mallard_document_init (YelpMallardDocument *mallard)
YelpMallardDocumentPrivate *priv = GET_PRIV (mallard);
xmlNodePtr cur;
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
priv->thread_running = FALSE;
priv->index_running = FALSE;
@@ -202,7 +202,7 @@ yelp_mallard_document_finalize (GObject *object)
YelpMallardDocumentPrivate *priv = GET_PRIV (object);
g_object_unref (priv->uri);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
g_hash_table_destroy (priv->pages_hash);
xmlFreeDoc (priv->cache);
@@ -282,14 +282,15 @@ mallard_request_page (YelpDocument *document,
return TRUE;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->state == MALLARD_STATE_BLANK) {
priv->state = MALLARD_STATE_THINKING;
priv->thread_running = TRUE;
g_object_ref (document);
- priv->thread = g_thread_create ((GThreadFunc) mallard_think,
- document, FALSE, NULL);
+ priv->thread = g_thread_new ("mallard-page",
+ (GThreadFunc) mallard_think,
+ document);
}
switch (priv->state) {
@@ -313,7 +314,7 @@ mallard_request_page (YelpDocument *document,
break;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return FALSE;
}
@@ -379,7 +380,7 @@ mallard_think (YelpMallardDocument *mallard)
mallard_page_data_free (page_data);
}
else {
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
yelp_document_set_root_id ((YelpDocument *) mallard,
page_data->page_id, "index");
yelp_document_set_page_id ((YelpDocument *) mallard,
@@ -403,7 +404,7 @@ mallard_think (YelpMallardDocument *mallard)
page_data->page_id,
YELP_DOCUMENT_SIGNAL_INFO,
NULL);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
g_object_unref (pagefile);
g_free (filename);
@@ -412,7 +413,7 @@ mallard_think (YelpMallardDocument *mallard)
}
g_strfreev (path);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
priv->state = MALLARD_STATE_IDLE;
while (priv->pending) {
gchar *page_id = (gchar *) priv->pending->data;
@@ -420,7 +421,7 @@ mallard_think (YelpMallardDocument *mallard)
g_free (page_id);
priv->pending = g_slist_delete_link (priv->pending, priv->pending);
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
done:
g_object_unref (children);
@@ -1098,8 +1099,9 @@ mallard_index (YelpDocument *document)
priv = GET_PRIV (document);
g_object_ref (document);
- priv->index = g_thread_create ((GThreadFunc) mallard_index_threaded,
- document, FALSE, NULL);
+ priv->index = g_thread_new ("mallard-index",
+ (GThreadFunc) mallard_index_threaded,
+ document);
priv->index_running = TRUE;
}
@@ -1121,7 +1123,7 @@ mallard_monitor_changed (GFileMonitor *monitor,
if (priv->thread_running)
return;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
g_hash_table_remove_all (priv->pages_hash);
g_object_set (mallard, "indexed", FALSE, NULL);
@@ -1145,8 +1147,9 @@ mallard_monitor_changed (GFileMonitor *monitor,
priv->state = MALLARD_STATE_THINKING;
priv->thread_running = TRUE;
g_object_ref (mallard);
- priv->thread = g_thread_create ((GThreadFunc) mallard_think,
- mallard, FALSE, NULL);
+ priv->thread = g_thread_new ("mallard-reload",
+ (GThreadFunc) mallard_think,
+ mallard);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
diff --git a/libyelp/yelp-man-document.c b/libyelp/yelp-man-document.c
index 8d8031b..3d0116b 100644
--- a/libyelp/yelp-man-document.c
+++ b/libyelp/yelp-man-document.c
@@ -50,7 +50,7 @@ struct _YelpManDocumentPrivate {
ManState state;
gchar *page_id;
- GMutex *mutex;
+ GMutex mutex;
GThread *thread;
xmlDocPtr xmldoc;
@@ -172,7 +172,7 @@ yelp_man_document_init (YelpManDocument *man)
YelpManDocumentPrivate *priv = GET_PRIV (man);
priv->state = MAN_STATE_BLANK;
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
}
static void
@@ -196,7 +196,7 @@ yelp_man_document_finalize (GObject *object)
if (priv->xmldoc)
xmlFreeDoc (priv->xmldoc);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
g_free (priv->page_id);
G_OBJECT_CLASS (yelp_man_document_parent_class)->finalize (object);
@@ -258,7 +258,7 @@ man_request_page (YelpDocument *document,
return handled;
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
switch (priv->state) {
case MAN_STATE_BLANK:
@@ -270,8 +270,9 @@ man_request_page (YelpDocument *document,
yelp_document_set_page_id (document, "//index", priv->page_id);
yelp_document_set_page_id (document, priv->page_id, priv->page_id);
yelp_document_set_root_id (document, priv->page_id, priv->page_id);
- priv->thread = g_thread_create ((GThreadFunc) man_document_process,
- document, FALSE, NULL);
+ priv->thread = g_thread_new ("man-page",
+ (GThreadFunc) man_document_process,
+ document);
break;
case MAN_STATE_PARSING:
break;
@@ -289,7 +290,7 @@ man_request_page (YelpDocument *document,
break;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return FALSE;
}
@@ -457,9 +458,9 @@ man_document_process (YelpManDocument *man)
yelp_document_error_pending ((YelpDocument *) man, error);
}
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->state == MAN_STATE_STOP) {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
goto done;
}
@@ -485,7 +486,7 @@ man_document_process (YelpManDocument *man)
NULL,
(const gchar * const *) params);
g_strfreev (params);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
done:
g_free (filepath);
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index 2635b9b..c202a05 100644
--- a/libyelp/yelp-settings.c
+++ b/libyelp/yelp-settings.c
@@ -32,7 +32,7 @@
#include "yelp-settings.h"
struct _YelpSettingsPriv {
- GMutex *mutex;
+ GMutex mutex;
gchar colors[YELP_SETTINGS_NUM_COLORS][8];
gchar *setfonts[YELP_SETTINGS_NUM_FONTS];
@@ -228,7 +228,7 @@ yelp_settings_init (YelpSettings *settings)
gint i;
settings->priv = GET_PRIV (settings);
- settings->priv->mutex = g_mutex_new ();
+ g_mutex_init (&settings->priv->mutex);
settings->priv->icon_size = 24;
for (i = 0; i < YELP_SETTINGS_NUM_ICONS; i++)
@@ -345,7 +345,7 @@ yelp_settings_finalize (GObject *object)
{
YelpSettings *settings = YELP_SETTINGS (object);
- g_mutex_free (settings->priv->mutex);
+ g_mutex_clear (&settings->priv->mutex);
g_hash_table_destroy (settings->priv->tokens);
@@ -484,15 +484,15 @@ yelp_settings_set_property (GObject *object,
YelpSettings *
yelp_settings_get_default (void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ static GMutex mutex;
static YelpSettings *settings = NULL;
- g_static_mutex_lock (&mutex);
+ g_mutex_lock (&mutex);
if (settings == NULL)
settings = g_object_new (YELP_TYPE_SETTINGS,
"gtk-settings", gtk_settings_get_default (),
"gtk-icon-theme", gtk_icon_theme_get_default (),
NULL);
- g_static_mutex_unlock (&mutex);
+ g_mutex_unlock (&mutex);
return settings;
}
@@ -505,9 +505,9 @@ yelp_settings_get_color (YelpSettings *settings,
gchar *colorstr;
g_return_val_if_fail (color < YELP_SETTINGS_NUM_COLORS, NULL);
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
colorstr = g_strdup (settings->priv->colors[color]);
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
return colorstr;
}
@@ -530,7 +530,7 @@ yelp_settings_set_colors (YelpSettings *settings,
YelpSettingsColor color;
va_list args;
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
va_start (args, first_color);
color = first_color;
@@ -547,7 +547,7 @@ yelp_settings_set_colors (YelpSettings *settings,
}
va_end (args);
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
g_signal_emit (settings, settings_signals[COLORS_CHANGED], 0);
}
@@ -584,12 +584,12 @@ yelp_settings_get_font (YelpSettings *settings,
gchar *ret;
g_return_val_if_fail (font < YELP_SETTINGS_NUM_FONTS, NULL);
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
if (settings->priv->setfonts[font])
ret = g_strdup (settings->priv->setfonts[font]);
else
ret = g_strdup (settings->priv->fonts[font]);
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
return ret;
}
@@ -602,7 +602,7 @@ yelp_settings_get_font_family (YelpSettings *settings,
gchar *desc, *ret, *c; /* do not free */
g_return_val_if_fail (font < YELP_SETTINGS_NUM_FONTS, NULL);
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
if (settings->priv->setfonts[font])
desc = g_strdup (settings->priv->setfonts[font]);
@@ -624,7 +624,7 @@ yelp_settings_get_font_family (YelpSettings *settings,
ret = g_strndup (desc, c - desc);
done:
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
return ret;
}
@@ -636,7 +636,7 @@ yelp_settings_get_font_size (YelpSettings *settings,
gint ret;
g_return_val_if_fail (font < YELP_SETTINGS_NUM_FONTS, 0);
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
if (settings->priv->setfonts[font])
desc = g_strdup (settings->priv->setfonts[font]);
@@ -658,7 +658,7 @@ yelp_settings_get_font_size (YelpSettings *settings,
ret = g_ascii_strtod (c, NULL);
done:
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
ret += settings->priv->font_adjustment;
ret = (ret < 5) ? 5 : ret;
return ret;
@@ -672,7 +672,7 @@ yelp_settings_set_fonts (YelpSettings *settings,
YelpSettingsFont font;
va_list args;
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
va_start (args, first_font);
font = first_font;
@@ -685,7 +685,7 @@ yelp_settings_set_fonts (YelpSettings *settings,
}
va_end (args);
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
g_signal_emit (settings, settings_signals[FONTS_CHANGED], 0);
}
@@ -727,9 +727,9 @@ yelp_settings_get_icon (YelpSettings *settings,
gchar *ret;
g_return_val_if_fail (icon < YELP_SETTINGS_NUM_ICONS, NULL);
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
ret = g_strdup (settings->priv->icons[icon]);
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
return ret;
}
@@ -742,7 +742,7 @@ yelp_settings_set_icons (YelpSettings *settings,
YelpSettingsIcon icon;
va_list args;
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
va_start (args, first_icon);
icon = first_icon;
@@ -755,7 +755,7 @@ yelp_settings_set_icons (YelpSettings *settings,
}
va_end (args);
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
g_signal_emit (settings, settings_signals[ICONS_CHANGED], 0);
}
@@ -895,7 +895,7 @@ gtk_theme_changed (GtkSettings *gtk_settings,
gdouble text_h, text_s, text_v;
gint i;
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
style = gtk_rc_get_style_by_paths (gtk_settings,
"GtkTextView", "GtkTextView",
@@ -1009,7 +1009,7 @@ gtk_theme_changed (GtkSettings *gtk_settings,
g_object_unref (G_OBJECT (style));
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
g_signal_emit (settings, settings_signals[COLORS_CHANGED], 0);
}
@@ -1051,7 +1051,7 @@ icon_theme_changed (GtkIconTheme *theme,
GtkIconInfo *info;
gint i;
- g_mutex_lock (settings->priv->mutex);
+ g_mutex_lock (&settings->priv->mutex);
for (i = 0; i < YELP_SETTINGS_NUM_ICONS; i++) {
if (settings->priv->icons[i] != NULL)
@@ -1070,7 +1070,7 @@ icon_theme_changed (GtkIconTheme *theme,
}
}
- g_mutex_unlock (settings->priv->mutex);
+ g_mutex_unlock (&settings->priv->mutex);
g_signal_emit (settings, settings_signals[ICONS_CHANGED], 0);
}
diff --git a/libyelp/yelp-sqlite-storage.c b/libyelp/yelp-sqlite-storage.c
index f2e6619..e592b02 100644
--- a/libyelp/yelp-sqlite-storage.c
+++ b/libyelp/yelp-sqlite-storage.c
@@ -60,7 +60,7 @@ typedef struct _YelpSqliteStoragePrivate YelpSqliteStoragePrivate;
struct _YelpSqliteStoragePrivate {
gchar *filename;
sqlite3 *db;
- GMutex *mutex;
+ GMutex mutex;
};
enum {
@@ -84,8 +84,7 @@ yelp_sqlite_storage_finalize (GObject *object)
if (priv->db)
sqlite3_close (priv->db);
- if (priv->mutex)
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
G_OBJECT_CLASS (yelp_sqlite_storage_parent_class)->finalize (object);
}
@@ -94,7 +93,7 @@ static void
yelp_sqlite_storage_init (YelpSqliteStorage *storage)
{
YelpSqliteStoragePrivate *priv = GET_PRIV (storage);
- priv->mutex = g_mutex_new ();
+ g_mutex_init (&priv->mutex);
}
static void
@@ -225,7 +224,7 @@ yelp_sqlite_storage_update (YelpStorage *storage,
sqlite3_stmt *stmt = NULL;
YelpSqliteStoragePrivate *priv = GET_PRIV (storage);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
sqlite3_prepare_v2 (priv->db,
"delete from pages where doc_uri = ? and lang = ? and full_uri = ?;",
@@ -250,7 +249,7 @@ yelp_sqlite_storage_update (YelpStorage *storage,
sqlite3_step (stmt);
sqlite3_finalize (stmt);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
static GVariant *
@@ -263,7 +262,7 @@ yelp_sqlite_storage_search (YelpStorage *storage,
GVariant *ret;
YelpSqliteStoragePrivate *priv = GET_PRIV (storage);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
sqlite3_prepare_v2 (priv->db,
"select full_uri, title, desc, icon from pages where"
@@ -284,7 +283,7 @@ yelp_sqlite_storage_search (YelpStorage *storage,
sqlite3_finalize (stmt);
ret = g_variant_new ("a(ssss)", &builder);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return ret;
}
@@ -297,7 +296,7 @@ yelp_sqlite_storage_get_root_title (YelpStorage *storage,
sqlite3_stmt *stmt = NULL;
YelpSqliteStoragePrivate *priv = GET_PRIV (storage);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
sqlite3_prepare_v2 (priv->db,
"select title from titles where doc_uri = ? and lang = ?;",
@@ -308,7 +307,7 @@ yelp_sqlite_storage_get_root_title (YelpStorage *storage,
ret = g_strdup (sqlite3_column_text (stmt, 0));
sqlite3_finalize (stmt);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return ret;
}
@@ -320,7 +319,7 @@ yelp_sqlite_storage_set_root_title (YelpStorage *storage,
sqlite3_stmt *stmt = NULL;
YelpSqliteStoragePrivate *priv = GET_PRIV (storage);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
sqlite3_prepare_v2 (priv->db,
"delete from titles where doc_uri = ? and lang = ?;",
@@ -340,5 +339,5 @@ yelp_sqlite_storage_set_root_title (YelpStorage *storage,
sqlite3_step (stmt);
sqlite3_finalize (stmt);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
diff --git a/libyelp/yelp-storage.c b/libyelp/yelp-storage.c
index e369f42..fc61740 100644
--- a/libyelp/yelp-storage.c
+++ b/libyelp/yelp-storage.c
@@ -42,11 +42,11 @@ yelp_storage_set_default (YelpStorage *storage)
YelpStorage *
yelp_storage_get_default (void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
- g_static_mutex_lock (&mutex);
+ static GMutex mutex;
+ g_mutex_lock (&mutex);
if (default_storage == NULL)
default_storage = yelp_sqlite_storage_new (":memory:");
- g_static_mutex_unlock (&mutex);
+ g_mutex_unlock (&mutex);
return default_storage;
}
diff --git a/libyelp/yelp-transform.c b/libyelp/yelp-transform.c
index eecfe6a..933ba04 100644
--- a/libyelp/yelp-transform.c
+++ b/libyelp/yelp-transform.c
@@ -109,7 +109,7 @@ struct _YelpTransformPrivate {
gchar **params;
GThread *thread;
- GMutex *mutex;
+ GMutex mutex;
GAsyncQueue *queue;
GHashTable *chunks;
@@ -239,7 +239,7 @@ yelp_transform_finalize (GObject *object)
g_hash_table_destroy (priv->chunks);
g_strfreev (priv->params);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
G_OBJECT_CLASS (yelp_transform_parent_class)->finalize (object);
}
@@ -304,13 +304,14 @@ yelp_transform_start (YelpTransform *transform,
priv->aux = auxiliary;
priv->params = g_strdupv ((gchar **) params);
- priv->mutex = g_mutex_new ();
- g_mutex_lock (priv->mutex);
+ g_mutex_init (&priv->mutex);
+ g_mutex_lock (&priv->mutex);
priv->running = TRUE;
g_object_ref (transform);
- priv->thread = g_thread_create ((GThreadFunc) transform_run,
- transform, FALSE, NULL);
- g_mutex_unlock (priv->mutex);
+ priv->thread = g_thread_new ("transform-run",
+ (GThreadFunc) transform_run,
+ transform);
+ g_mutex_unlock (&priv->mutex);
return TRUE;
}
@@ -322,13 +323,13 @@ yelp_transform_take_chunk (YelpTransform *transform,
YelpTransformPrivate *priv = GET_PRIV (transform);
gchar *buf;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
buf = g_hash_table_lookup (priv->chunks, chunk_id);
if (buf)
g_hash_table_remove (priv->chunks, chunk_id);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
/* The caller assumes ownership of this memory. */
return buf;
@@ -338,13 +339,13 @@ void
yelp_transform_cancel (YelpTransform *transform)
{
YelpTransformPrivate *priv = GET_PRIV (transform);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->running) {
priv->cancelled = TRUE;
if (priv->context)
priv->context->state = XSLT_STATE_STOPPED;
}
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
GError *
@@ -353,10 +354,10 @@ yelp_transform_get_error (YelpTransform *transform)
YelpTransformPrivate *priv = GET_PRIV (transform);
GError *ret = NULL;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->error)
ret = g_error_copy (priv->error);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return ret;
}
@@ -372,7 +373,7 @@ transform_run (YelpTransform *transform)
priv->stylesheet = xsltParseStylesheetFile (BAD_CAST (priv->stylesheet_file));
if (priv->stylesheet == NULL) {
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->error)
g_error_free (priv->error);
priv->error = g_error_new (YELP_ERROR, YELP_ERROR_PROCESSING,
@@ -380,14 +381,14 @@ transform_run (YelpTransform *transform)
priv->stylesheet_file);
g_object_ref (transform);
g_idle_add ((GSourceFunc) transform_error, transform);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return;
}
priv->context = xsltNewTransformContext (priv->stylesheet,
priv->input);
if (priv->context == NULL) {
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->error)
g_error_free (priv->error);
priv->error = g_error_new (YELP_ERROR, YELP_ERROR_PROCESSING,
@@ -395,7 +396,7 @@ transform_run (YelpTransform *transform)
priv->stylesheet_file);
g_object_ref (transform);
g_idle_add ((GSourceFunc) transform_error, transform);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
return;
}
@@ -418,14 +419,14 @@ transform_run (YelpTransform *transform)
(const char **) priv->params,
NULL, NULL,
priv->context);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
priv->running = FALSE;
if (!priv->cancelled) {
g_idle_add ((GSourceFunc) transform_final, transform);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
}
else {
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
g_object_unref (transform);
}
}
@@ -561,7 +562,7 @@ xslt_yelp_document (xsltTransformContextPtr ctxt,
ctxt->output = old_doc;
ctxt->insert = old_insert;
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
temp = g_strdup ((gchar *) page_id);
xmlFree (page_id);
@@ -572,7 +573,7 @@ xslt_yelp_document (xsltTransformContextPtr ctxt,
g_object_ref (transform);
g_idle_add ((GSourceFunc) transform_chunk, transform);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
done:
if (new_doc)
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index be23df2..8708d1c 100644
--- a/libyelp/yelp-uri.c
+++ b/libyelp/yelp-uri.c
@@ -301,8 +301,9 @@ resolve_start (YelpUri *uri)
if (priv->resolver == NULL) {
g_object_ref (uri);
- priv->resolver = g_thread_create ((GThreadFunc) resolve_async,
- uri, FALSE, NULL);
+ priv->resolver = g_thread_new ("uri-resolve",
+ (GThreadFunc) resolve_async,
+ uri);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]