{
d (printf ("destroying search closure\n"));
e_flag_free (closure->running);
+ if (closure->thread)
+ g_thread_unref (closure->thread);
g_free (closure);
}
FileBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_FILE (backend));
d (printf ("starting book view thread\n"));
- closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
+ closure->thread = g_thread_new (NULL, book_view_thread, book_view);
e_flag_wait (closure->running);
need_join = e_flag_is_set (closure->running);
e_flag_clear (closure->running);
- if (need_join)
+ if (need_join) {
g_thread_join (closure->thread);
+ closure->thread = NULL;
+ }
}
/*
};
/* GDataAuthorizer methods must be thread-safe. */
-static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+static GMutex mutex;
/* Forward Declarations */
static void e_gdata_goa_authorizer_interface_init
GDataAuthorizationDomain *domain,
SoupMessage *message)
{
- g_static_mutex_lock (&mutex);
+ g_mutex_lock (&mutex);
if (gdata_goa_authorizer_is_authorized (authorizer, domain))
gdata_goa_authorizer_add_authorization (authorizer, message);
- g_static_mutex_unlock (&mutex);
+ g_mutex_unlock (&mutex);
}
static gboolean
{
gboolean authorized;
- g_static_mutex_lock (&mutex);
+ g_mutex_lock (&mutex);
authorized = gdata_goa_authorizer_is_authorized (authorizer, domain);
- g_static_mutex_unlock (&mutex);
+ g_mutex_unlock (&mutex);
return authorized;
}
priv = E_GDATA_GOA_AUTHORIZER_GET_PRIVATE (authorizer);
- g_static_mutex_lock (&mutex);
+ g_mutex_lock (&mutex);
g_free (priv->access_token);
priv->access_token = NULL;
if (goa_oauth2_based != NULL)
g_object_unref (goa_oauth2_based);
- g_static_mutex_unlock (&mutex);
+ g_mutex_unlock (&mutex);
return success;
}
gboolean marked_for_offline;
/* our operations */
- GStaticRecMutex op_hash_mutex;
+ GRecMutex op_hash_mutex;
GHashTable *id_to_op;
gint active_ops;
guint poll_timeout;
};
/* every access to priv->ldap should be guarded with this lock */
-static GStaticRecMutex eds_ldap_handler_lock = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex eds_ldap_handler_lock;
static void ldap_op_add (LDAPOp *op, EBookBackend *backend, EDataBook *book,
EDataBookView *view, gint opid, gint msgid, LDAPOpHandler handler, LDAPOpDtor dtor);
LDAPMessage *resp;
struct timeval timeout;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (!bl->priv->schema_dn)
return;
timeout.tv_sec = 30;
timeout.tv_usec = 0;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (ldap_search_ext_s (bl->priv->ldap, bl->priv->schema_dn, LDAP_SCOPE_BASE,
"(objectClass=subschema)", (gchar **) attrs, 0,
NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp) == LDAP_SUCCESS) {
gchar **values;
values = ldap_get_values (bl->priv->ldap, resp, "objectClasses");
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (values) {
gint i;
ldap_msgfree (resp);
}
else {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
}
gint i = 0;
struct timeval timeout;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
return ldap_error;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
attrs[i++] = "supportedControl";
attrs[i++] = "supportedExtension";
timeout.tv_sec = 30;
timeout.tv_usec = 0;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_ext_s (
bl->priv->ldap,
LDAP_ROOT_DSE, LDAP_SCOPE_BASE,
"(objectclass=*)",
(gchar **) attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning ("could not perform query on Root DSE (ldap_error 0x%02x/%s)", ldap_error, ldap_err2string (ldap_error) ? ldap_err2string (ldap_error) : "Unknown error");
return ldap_error;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, resp, "supportedControl");
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (values) {
if (enable_debug) {
for (i = 0; values[i]; i++)
ldap_value_free (values);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, resp, "supportedExtension");
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (values) {
if (enable_debug) {
for (i = 0; values[i]; i++) {
ldap_value_free (values);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, resp, "supportedSASLMechanisms");
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (values) {
gchar *auth_method;
if (bl->priv->supported_auth_methods) {
ldap_value_free (values);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, resp, "subschemaSubentry");
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (!values || !values[0]) {
if (values) ldap_value_free (values);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, resp, "schemaNamingContext");
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
if (values && values[0]) {
g_free (bl->priv->schema_dn);
}
/* close connection first if it's open first */
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (blpriv->ldap) {
ldap_unbind (blpriv->ldap);
}
g_message ("TLS not available (fatal version), v3 protocol could not be established (ldap_error 0x%02x)", ldap_error);
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_propagate_error (error, EDB_ERROR (TLS_NOT_AVAILABLE));
return FALSE;
}
g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_propagate_error (error, EDB_ERROR (TLS_NOT_AVAILABLE));
return FALSE;
} else if (enable_debug)
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_propagate_error (
error, e_data_book_create_error (
E_DATA_BOOK_STATUS_OTHER_ERROR,
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_propagate_error (error, EDB_ERROR (REPOSITORY_OFFLINE));
return FALSE;
} else if (ldap_error == LDAP_INVALID_CREDENTIALS) {
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_propagate_error (error, EDB_ERROR (AUTHENTICATION_FAILED));
return FALSE;
}
|| ldap_error == LDAP_PARTIAL_RESULTS
|| LDAP_NAME_ERROR (ldap_error)) {
blpriv->connected = TRUE;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* check to see if evolutionPerson is supported, if we can (me
* might not be able to if we can't authenticate. if we
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_propagate_error (error, EDB_ERROR (AUTHENTICATION_FAILED));
return FALSE;
} else {
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_warning ("Failed to perform root dse query anonymously, (ldap_error 0x%02x)", ldap_error);
}
} else {
ldap_unbind (blpriv->ldap);
blpriv->ldap = NULL;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
g_warning (
g_get_current_time (&start);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (enable_debug)
printf ("e_book_backend_ldap_reconnect ... ldap handler is NULL\n");
return FALSE;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* we need to reconnect if we were previously connected */
if (bl->priv->connected && ldap_status == LDAP_SERVER_DOWN) {
}
if (bl->priv->auth_dn) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_simple_bind_s (
bl->priv->ldap,
bl->priv->auth_dn,
bl->priv->auth_secret);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
book_view_notify_status (bl, book_view, "");
op->handler = handler;
op->dtor = dtor;
- g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_lock (&bl->priv->op_hash_mutex);
if (g_hash_table_lookup (bl->priv->id_to_op, &op->id)) {
g_warning ("conflicting ldap msgid's");
}
bl->priv->poll_timeout = g_timeout_add (
LDAP_POLL_INTERVAL,
(GSourceFunc) poll_ldap, bl);
- g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
}
static void
EBookBackend *backend = op->backend;
EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
- g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_lock (&bl->priv->op_hash_mutex);
g_hash_table_remove (bl->priv->id_to_op, &op->id);
/* clear the status message too */
book_view_notify_status (bl, find_book_view (bl), "");
/* should handle errors here */
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (bl->priv->ldap)
ldap_abandon (bl->priv->ldap, op->id);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (op->dtor)
op->dtor (op);
bl->priv->poll_timeout = 0;
}
}
- g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
}
static void
EBookBackend *backend = op->backend;
EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
- g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_lock (&bl->priv->op_hash_mutex);
g_hash_table_remove (bl->priv->id_to_op, &op->id);
op->id = msg_id;
g_hash_table_insert (bl->priv->id_to_op, &op->id, op);
- g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
}
static GError *
gint ldap_error;
GSList added_contacts = {NULL,};
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_create_contacts (
op->book,
op->opid,
ldap_op_finished (op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (LDAP_RES_ADD != ldap_msgtype (res)) {
e_data_book_respond_create_contacts (
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"create_contact_handler: %02X (%s), additional info: %s",
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_create_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
book_view = find_book_view (bl);
do {
book_view_notify_status (bl, book_view, _("Adding contact to LDAP server..."));
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
err = ldap_add_ext (
bl->priv->ldap, create_op->dn, ldap_mods,
NULL, NULL, &create_contact_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, book_view, err));
gint ldap_error;
GSList *ids = NULL;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_remove_contacts (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
ldap_op_finished (op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (LDAP_RES_DELETE != ldap_msgtype (res)) {
e_data_book_respond_remove_contacts (
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"remove_contact_handler: %02X (%s), additional info: %s",
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_remove_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
g_free (remove_op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
book_view = find_book_view (bl);
do {
book_view_notify_status (bl, book_view, _("Removing contact from LDAP server..."));
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_delete_ext (
bl->priv->ldap,
remove_op->id,
NULL, NULL, &remove_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
if (ldap_error != LDAP_SUCCESS) {
gint ldap_error;
GSList modified_contacts = {NULL,};
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_modify_contacts (op->book,
op->opid,
EDB_ERROR_NOT_CONNECTED (),
ldap_op_finished (op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (LDAP_RES_MODIFY != ldap_msgtype (res)) {
e_data_book_respond_modify_contacts (op->book,
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"modify_contact_modify_handler: %02X (%s), additional info: %s",
EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (op->backend);
gint msg_type;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_modify_contacts (op->book, op->opid,
EDB_ERROR_NOT_CONNECTED (), NULL);
ldap_op_finished (op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* if it's successful, we should get called with a
* RES_SEARCH_ENTRY and a RES_SEARCH_RESULT. if it's
if (msg_type == LDAP_RES_SEARCH_ENTRY) {
LDAPMessage *e;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (!e) {
e_data_book_respond_modify_contacts (op->book,
/* grab the result code, and set up the actual modify (or rename)
* if it was successful */
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"modify_contact_search_handler: %02X (%s), additional info: %s",
gint rename_contact_msgid;
/* actually perform the ldap rename */
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_rename (
bl->priv->ldap, current_dn,
new_uid /* newRDN */,
NULL /* NewSuperior */,
0 /* deleteOldRDN */,
NULL, NULL, &rename_contact_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_free (new_uid);
gboolean differences;
gint modify_contact_msgid;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_modify_contacts (op->book,
op->opid,
EDB_ERROR_NOT_CONNECTED (),
ldap_op_finished (op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* was a rename necessary? */
if (modify_op->new_id) {
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"modify_contact_rename_handler: %02X (%s), additional info: %s",
}
#endif
/* actually perform the ldap modify */
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_modify_ext (
bl->priv->ldap, modify_op->id, ldap_mods,
NULL, NULL, &modify_contact_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error == LDAP_SUCCESS) {
op->handler = modify_contact_modify_handler;
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_modify_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
g_free (modify_op);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
book_view = find_book_view (bl);
do {
book_view_notify_status (bl, book_view, _("Modifying contact from LDAP server..."));
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_ext (
bl->priv->ldap, modify_op->id,
LDAP_SCOPE_BASE,
NULL, 0, NULL, NULL,
NULL, /* XXX timeout */
1, &modify_contact_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
g_get_current_time (&start);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
ldap_op_finished (op);
if (enable_debug)
printf ("get_contact_handler... ldap handler is NULL \n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* the msg_type will be either SEARCH_ENTRY (if we're
* successful) or SEARCH_RESULT (if we're not), so we finish
EContact *contact;
gchar *vcard;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (!e) {
e_data_book_respond_get_contact (
gchar *ldap_error_msg;
gint ldap_error;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"get_contact_handler: %02X (%s), additional info: %s",
g_get_current_time (&start);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
if (enable_debug)
printf ("e_book_backend_ldap_get_contact ... ldap handler is NULL\n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
get_contact_op = g_new0 (LDAPGetContactOp, 1);
book_view = find_book_view (bl);
do {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_ext (
bl->priv->ldap, id,
LDAP_SCOPE_BASE,
NULL, 0, NULL, NULL,
NULL, /* XXX timeout */
1, &get_contact_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
if (ldap_error == LDAP_SUCCESS) {
g_get_current_time (&start);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact_list (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
ldap_op_finished (op);
if (enable_debug)
printf ("contact_list_handler ... ldap handler is NULL \n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
msg_type = ldap_msgtype (res);
if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
while (NULL != e) {
EContact *contact;
g_object_unref (contact);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_next_entry (bl->priv->ldap, e);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
/* ignore references */
gchar *ldap_error_msg;
gint ldap_error;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"contact_list_handler: %02X (%s), additional info: %s",
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
if (enable_debug)
printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
contact_list_op = g_new0 (LDAPGetContactListOp, 1);
book_view = find_book_view (bl);
printf ("getting contact list with filter: %s\n", ldap_query);
do {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_ext (
bl->priv->ldap,
bl->priv->ldap_rootdn,
NULL, 0, NULL, NULL,
NULL, /* XXX timeout */
LDAP_NO_LIMIT, &contact_list_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
g_free (ldap_query);
g_get_current_time (&start);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact_list_uids (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
ldap_op_finished (op);
if (enable_debug)
printf ("contact_list_uids_handler ... ldap handler is NULL \n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
msg_type = ldap_msgtype (res);
if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
while (NULL != e) {
EContact *contact;
contact_list_uids_op->uids = g_slist_append (contact_list_uids_op->uids, uid);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_next_entry (bl->priv->ldap, e);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
/* ignore references */
gchar *ldap_error_msg;
gint ldap_error;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"contact_list_uids_handler: %02X (%s), additional info: %s",
return;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact_list_uids (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
if (enable_debug)
printf ("e_book_backend_ldap_get_contact_list_uids... ldap handler is NULL\n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
contact_list_uids_op = g_new0 (LDAPGetContactListUIDsOp, 1);
book_view = find_book_view (bl);
printf ("getting contact list uids with filter: %s\n", ldap_query);
do {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_ext (
bl->priv->ldap,
bl->priv->ldap_rootdn,
NULL, 0, NULL, NULL,
NULL, /* XXX timeout */
LDAP_NO_LIMIT, &contact_list_uids_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
g_free (ldap_query);
gchar *attr;
BerElement *ber = NULL;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
dn = ldap_get_dn (bl->priv->ldap, e);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_contact_set (contact, E_CONTACT_UID, dn);
ldap_memfree (dn);
if (ldap_uid) *ldap_uid = NULL;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
for (attr = ldap_first_attribute (bl->priv->ldap, e, &ber); attr;
attr = ldap_next_attribute (bl->priv->ldap, e, ber)) {
gint i;
struct prop_info *info = NULL;
gchar **values;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (enable_debug)
printf ("attr = %s \n", attr);
if (ldap_uid && !g_ascii_strcasecmp (attr, "uid")) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, e, attr);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (values) {
if (enable_debug)
printf ("uid value = %s\n", values[0]);
ldap_value_free (values);
}
} else if (!g_ascii_strcasecmp (attr, "objectclass")) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, e, attr);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
for (i = 0; values[i]; i++) {
if (enable_debug)
printf ("value = %s\n", values[i]);
if (info) {
if (info->prop_type & PROP_WRITE_ONLY) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
continue;
}
if (info->prop_type & PROP_TYPE_BINARY) {
struct berval **ber_values;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ber_values = ldap_get_values_len (bl->priv->ldap, e, attr);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ber_values) {
info->binary_populate_contact_func (contact, ber_values);
}
}
else {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
values = ldap_get_values (bl->priv->ldap, e, attr);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (values) {
if (info->prop_type & PROP_TYPE_STRING) {
if (enable_debug)
printf ("value (dn) = %s \n", values[j]);
do {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if ((ldap_error = ldap_search_ext_s (bl->priv->ldap,
values[j],
LDAP_SCOPE_BASE,
ldap_value_free (cn_values);
}
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
}
ldap_memfree (attr);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ber)
ber_free (ber, 0);
const gchar *ldap_timeout_string;
gboolean again;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap || !bl->priv->poll_timeout) {
bl->priv->poll_timeout = 0;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
return FALSE;
}
if (!bl->priv->active_ops) {
g_warning ("poll_ldap being called for backend with no active operations");
bl->priv->poll_timeout = 0;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
return FALSE;
}
if (!bl->priv->poll_timeout || !e_book_backend_ldap_reconnect (bl, book_view, LDAP_SERVER_DOWN)) {
if (bl->priv->poll_timeout)
g_warning ("%s: Failed to reconnect to LDAP server", G_STRFUNC);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
return FALSE;
}
} else {
gint msgid = ldap_msgid (res);
LDAPOp *op;
- g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_lock (&bl->priv->op_hash_mutex);
op = g_hash_table_lookup (bl->priv->id_to_op, &msgid);
d (printf ("looked up msgid %d, got op %p\n", msgid, op));
/* XXX should the call to op->handler be
* protected by the lock? */
- g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
ldap_msgfree (res);
}
/* the poll_timeout is set to 0, when finalizing the backend */
again = bl->priv->poll_timeout > 0;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
return again;
}
if (enable_debug)
g_get_current_time (&start);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
GError *edb_err = EDB_ERROR_NOT_CONNECTED ();
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_view_notify_complete (view, edb_err);
ldap_op_finished (op);
if (enable_debug)
g_error_free (edb_err);
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (!search_op->notified_receiving_results) {
search_op->notified_receiving_results = TRUE;
msg_type = ldap_msgtype (res);
if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
while (NULL != e) {
EContact *contact = build_contact_from_entry (bl, e, NULL, NULL);
e_data_book_view_notify_update (view, contact);
g_object_unref (contact);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_next_entry (bl->priv->ldap, e);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
/* ignore references */
gchar *ldap_error_msg;
gint ldap_error;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"ldap_search_handler: %02X (%s), additional info: %s",
if (!ldap_query && can_browse ((EBookBackend *) bl))
ldap_query = g_strdup ("(cn=*)");
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (ldap_query != NULL && bl->priv->ldap) {
gint ldap_err;
gint search_msgid;
gint view_limit;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
view_limit = bl->priv->ldap_limit;
/* if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
do {
book_view_notify_status (bl, view, _("Searching..."));
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_err = ldap_search_ext (
bl->priv->ldap, bl->priv->ldap_rootdn,
bl->priv->ldap_scope,
NULL, /* XXX */
NULL, /* XXX timeout */
view_limit, &search_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (bl, view, ldap_err));
g_free (ldap_query);
}
return;
} else {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* Ignore NULL query */
e_data_book_view_notify_complete (view, NULL /* Success */);
return;
g_get_current_time (&start);
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
ldap_op_finished (op);
if (enable_debug)
printf ("generate_cache_handler ... ldap handler is NULL \n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
book_view = find_book_view (bl);
msg_type = ldap_msgtype (res);
if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
while (e != NULL) {
EContact *contact = build_contact_from_entry (bl, e, NULL, NULL);
contact_list_op->contacts = g_slist_prepend (contact_list_op->contacts, contact);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_next_entry (bl->priv->ldap, e);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
} else {
GSList *l;
priv = book_backend_ldap->priv;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!priv->ldap) {
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_free (contact_list_op);
if (enable_debug)
printf ("generating offline cache failed ... ldap handler is NULL\n");
return;
}
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
do {
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_ext (
priv->ldap,
priv->ldap_rootdn,
NULL, 0, NULL, NULL,
NULL, /* XXX timeout */
LDAP_NO_LIMIT, &contact_list_msgid);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
} while (e_book_backend_ldap_reconnect (book_backend_ldap, NULL, ldap_error));
if (ldap_error == LDAP_SUCCESS) {
LDAPOp *op = value;
/* ignore errors, its only best effort? */
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (bl->priv->ldap)
ldap_abandon (bl->priv->ldap, op->id);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
static void
{
EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
- g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_lock (&bl->priv->op_hash_mutex);
g_hash_table_foreach (bl->priv->id_to_op, ldap_cancel_op, bl);
- g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
+ g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
}
static void
bl = E_BOOK_BACKEND_LDAP (op->backend);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (bl->priv->ldap)
ldap_abandon (bl->priv->ldap, op->id);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
op->dtor (op);
priv = E_BOOK_BACKEND_LDAP_GET_PRIVATE (object);
- g_static_rec_mutex_lock (&priv->op_hash_mutex);
+ g_rec_mutex_lock (&priv->op_hash_mutex);
g_hash_table_foreach_remove (priv->id_to_op, (GHRFunc) call_dtor, NULL);
g_hash_table_destroy (priv->id_to_op);
- g_static_rec_mutex_unlock (&priv->op_hash_mutex);
- g_static_rec_mutex_free (&priv->op_hash_mutex);
+ g_rec_mutex_unlock (&priv->op_hash_mutex);
+ g_rec_mutex_clear (&priv->op_hash_mutex);
/* Remove the timeout before unbinding to avoid a race. */
if (priv->poll_timeout > 0) {
priv->poll_timeout = 0;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (priv->ldap)
ldap_unbind (priv->ldap);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_slist_foreach (priv->supported_fields, (GFunc) g_free, NULL);
g_slist_free (priv->supported_fields);
gchar *query = g_strdup_printf ("(mail=%s)", user);
gchar *entry_dn;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
ldap_error = ldap_search_s (
bl->priv->ldap,
bl->priv->ldap_rootdn,
bl->priv->ldap_scope,
query,
NULL, 0, &res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
g_free (query);
if (ldap_error != LDAP_SUCCESS)
goto exit;
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
e = ldap_first_entry (bl->priv->ldap, res);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (!e) {
ldap_msgfree (res);
g_set_error (
return E_SOURCE_AUTHENTICATION_ERROR;
}
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
entry_dn = ldap_get_dn (bl->priv->ldap, e);
bl->priv->connected = FALSE; /* to reconnect with credentials */
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
dn = g_strdup (entry_dn);
ldap_memfree (entry_dn);
if (enable_debug)
printf ("simple auth as %s\n", dn);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->connected || !bl->priv->ldap) {
GError *local_error = NULL;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_book_backend_ldap_connect (bl, &local_error);
bl->priv->ldap,
bl->priv->auth_dn,
bl->priv->auth_secret);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
/* Some ldap servers are returning (ex active directory ones)
* LDAP_SERVER_DOWN when we try to do an ldap operation after
#ifdef ENABLE_SASL_BINDS
else if (!g_ascii_strncasecmp (method, SASL_PREFIX, strlen (SASL_PREFIX))) {
g_print ("sasl bind (mech = %s) as %s", method + strlen (SASL_PREFIX), user);
- g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+ g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->connected || !bl->priv->ldap) {
GError *local_error = NULL;
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_book_backend_ldap_connect (bl, &local_error);
NULL,
NULL,
NULL);
- g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+ g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
#endif
else {
backend->priv->ldap_limit = 100;
backend->priv->id_to_op = g_hash_table_new (g_int_hash, g_int_equal);
- g_static_rec_mutex_init (&backend->priv->op_hash_mutex);
+ g_rec_mutex_init (&backend->priv->op_hash_mutex);
if (g_getenv ("LDAP_DEBUG"))
enable_debug = TRUE;
((obj), E_TYPE_SOURCE_LDAP, ESourceLDAPPrivate))
struct _ESourceLDAPPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gboolean can_browse;
gchar *filter;
guint limit;
priv = E_SOURCE_LDAP_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->filter);
g_free (priv->root_dn);
e_source_ldap_init (ESourceLDAP *extension)
{
extension->priv = E_SOURCE_LDAP_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
void
g_return_val_if_fail (E_IS_SOURCE_LDAP (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_ldap_get_filter (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
!g_str_has_prefix (filter, "(") &&
!g_str_has_suffix (filter, ")");
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (needs_parens)
new_filter = g_strdup_printf ("(%s)", filter);
new_filter = g_strdup (filter);
if (g_strcmp0 (extension->priv->filter, new_filter) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_free (new_filter);
return;
}
g_free (extension->priv->filter);
extension->priv->filter = new_filter;
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "filter");
}
g_return_val_if_fail (E_IS_SOURCE_LDAP (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_ldap_get_root_dn (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_LDAP (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->root_dn, root_dn) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->root_dn);
extension->priv->root_dn = e_util_strdup_strip (root_dn);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "root-dn");
}
struct _EBookBackendVCFPrivate {
gchar *filename;
- GMutex *mutex;
+ GMutex mutex;
GHashTable *contacts;
GList *contact_list;
gboolean dirty;
g_warning ("EBookBackendVCF flushing file to disk");
- g_mutex_lock (vcf->priv->mutex);
+ g_mutex_lock (&vcf->priv->mutex);
new_path = g_strdup_printf ("%s.new", vcf->priv->filename);
close (fd);
g_free (new_path);
vcf->priv->dirty = !retv;
- g_mutex_unlock (vcf->priv->mutex);
+ g_mutex_unlock (&vcf->priv->mutex);
return retv;
}
/* at the very least we need the unique_id generation to be
* protected by the lock, even if the actual vcard parsing
* isn't. */
- g_mutex_lock (bvcf->priv->mutex);
+ g_mutex_lock (&bvcf->priv->mutex);
id = e_book_backend_vcf_create_unique_id ();
contact = e_contact_new_from_vcard_with_uid (vcard_req, id);
vcf_flush_file, bvcf);
}
- g_mutex_unlock (bvcf->priv->mutex);
+ g_mutex_unlock (&bvcf->priv->mutex);
return contact;
}
return;
}
- g_mutex_lock (bvcf->priv->mutex);
+ g_mutex_lock (&bvcf->priv->mutex);
elem = g_hash_table_lookup (bvcf->priv->contacts, id);
if (!elem) {
- g_mutex_unlock (bvcf->priv->mutex);
+ g_mutex_unlock (&bvcf->priv->mutex);
g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
return;
}
if (!g_hash_table_remove (bvcf->priv->contacts, id)) {
- g_mutex_unlock (bvcf->priv->mutex);
+ g_mutex_unlock (&bvcf->priv->mutex);
g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
return;
}
bvcf->priv->flush_timeout_tag = g_timeout_add (
FILE_FLUSH_TIMEOUT,
vcf_flush_file, bvcf);
- g_mutex_unlock (bvcf->priv->mutex);
+ g_mutex_unlock (&bvcf->priv->mutex);
*ids = g_slist_append (*ids, g_strdup (id));
}
contact = e_contact_new_from_vcard (vcards->data);
id = e_contact_get_const (contact, E_CONTACT_UID);
- g_mutex_lock (bvcf->priv->mutex);
+ g_mutex_lock (&bvcf->priv->mutex);
elem = g_hash_table_lookup (bvcf->priv->contacts, id);
if (!elem) {
- g_mutex_unlock (bvcf->priv->mutex);
+ g_mutex_unlock (&bvcf->priv->mutex);
g_propagate_error (perror, EDB_ERROR (CONTACT_NOT_FOUND));
return;
}
bvcf->priv->flush_timeout_tag = g_timeout_add (
FILE_FLUSH_TIMEOUT,
vcf_flush_file, bvcf);
- g_mutex_unlock (bvcf->priv->mutex);
+ g_mutex_unlock (&bvcf->priv->mutex);
*modified_contacts = g_slist_append (*modified_contacts, contact);
}
{
d (printf ("destroying search closure\n"));
e_flag_free (closure->running);
+ if (closure->thread)
+ g_thread_unref (closure->thread);
g_free (closure);
}
VCFBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_VCF (backend));
d (printf ("starting book view thread\n"));
- closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
+ closure->thread = g_thread_new (NULL, book_view_thread, book_view);
e_flag_wait (closure->running);
need_join = e_flag_is_set (closure->running);
e_flag_clear (closure->running);
- if (need_join)
+ if (need_join) {
g_thread_join (closure->thread);
+ closure->thread = NULL;
+ }
}
#ifdef CREATE_DEFAULT_VCARD
priv = E_BOOK_BACKEND_VCF_GET_PRIVATE (object);
- g_mutex_lock (priv->mutex);
+ g_mutex_lock (&priv->mutex);
if (priv->flush_timeout_tag)
g_source_remove (priv->flush_timeout_tag);
g_free (priv->filename);
- g_mutex_unlock (priv->mutex);
+ g_mutex_unlock (&priv->mutex);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_book_backend_vcf_parent_class)->finalize (object);
e_book_backend_vcf_init (EBookBackendVCF *backend)
{
backend->priv = E_BOOK_BACKEND_VCF_GET_PRIVATE (backend);
- backend->priv->mutex = g_mutex_new ();
+ g_mutex_init (&backend->priv->mutex);
g_signal_connect (
backend, "notify::online",
((obj), E_TYPE_SOURCE_VCF, ESourceVCFPrivate))
struct _ESourceVCFPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *path;
};
priv = E_SOURCE_VCF_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->path);
e_source_vcf_init (ESourceVCF *extension)
{
extension->priv = E_SOURCE_VCF_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
void
g_return_val_if_fail (E_IS_SOURCE_VCF (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_vcf_get_path (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_VCF (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->path, path) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->path);
extension->priv->path = e_util_strdup_strip (path);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "path");
}
closure_destroy (WebdavBackendSearchClosure *closure)
{
e_flag_free (closure->running);
+ if (closure->thread)
+ g_thread_unref (closure->thread);
g_free (closure);
}
= init_closure (book_view, E_BOOK_BACKEND_WEBDAV (backend));
closure->thread
- = g_thread_create (book_view_thread, book_view, TRUE, NULL);
+ = g_thread_new (NULL, book_view_thread, book_view);
e_flag_wait (closure->running);
}
if (need_join) {
g_thread_join (closure->thread);
+ closure->thread = NULL;
}
}
static guint active_book_clients = 0, book_connection_closed_id = 0;
static EGdbusBookFactory *book_factory = NULL;
-static GStaticRecMutex book_factory_lock = G_STATIC_REC_MUTEX_INIT;
-#define LOCK_FACTORY() g_static_rec_mutex_lock (&book_factory_lock)
-#define UNLOCK_FACTORY() g_static_rec_mutex_unlock (&book_factory_lock)
+static GRecMutex book_factory_lock;
+#define LOCK_FACTORY() g_rec_mutex_lock (&book_factory_lock)
+#define UNLOCK_FACTORY() g_rec_mutex_unlock (&book_factory_lock)
static void gdbus_book_factory_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data);
#define DB_FILENAME "contacts.db"
#define FOLDER_VERSION 1
-#define READER_LOCK(ebsdb) g_static_rw_lock_reader_lock (&ebsdb->priv->rwlock)
-#define READER_UNLOCK(ebsdb) g_static_rw_lock_reader_unlock (&ebsdb->priv->rwlock)
-#define WRITER_LOCK(ebssdb) g_static_rw_lock_writer_lock (&ebsdb->priv->rwlock)
-#define WRITER_UNLOCK(ebssdb) g_static_rw_lock_writer_unlock (&ebsdb->priv->rwlock)
+#define READER_LOCK(ebsdb) g_rw_lock_reader_lock (&ebsdb->priv->rwlock)
+#define READER_UNLOCK(ebsdb) g_rw_lock_reader_unlock (&ebsdb->priv->rwlock)
+#define WRITER_LOCK(ebssdb) g_rw_lock_writer_lock (&ebsdb->priv->rwlock)
+#define WRITER_UNLOCK(ebssdb) g_rw_lock_writer_unlock (&ebsdb->priv->rwlock)
struct _EBookBackendSqliteDBPrivate {
sqlite3 *db;
gchar *hash_key;
gboolean store_vcard;
- GStaticRWLock rwlock;
+ GRWLock rwlock;
- GMutex *in_transaction_lock;
+ GMutex in_transaction_lock;
guint32 in_transaction;
};
(e_book_backend_sqlitedb_error_quark ())
static GHashTable *db_connections = NULL;
-static GStaticMutex dbcon_lock = G_STATIC_MUTEX_INIT;
+static GMutex dbcon_lock;
typedef struct {
EContactField field; /* The EContact field */
priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (object);
- g_static_mutex_lock (&dbcon_lock);
+ g_mutex_lock (&dbcon_lock);
if (db_connections != NULL) {
if (priv->hash_key != NULL) {
g_hash_table_remove (db_connections, priv->hash_key);
priv->hash_key = NULL;
}
}
- g_static_mutex_unlock (&dbcon_lock);
+ g_mutex_unlock (&dbcon_lock);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_book_backend_sqlitedb_parent_class)->dispose (object);
priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (object);
- g_static_rw_lock_free (&priv->rwlock);
+ g_rw_lock_clear (&priv->rwlock);
sqlite3_close (priv->db);
g_free (priv->path);
- g_mutex_free (priv->in_transaction_lock);
+ g_mutex_clear (&priv->in_transaction_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_book_backend_sqlitedb_parent_class)->finalize (object);
ebsdb->priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (ebsdb);
ebsdb->priv->store_vcard = TRUE;
- g_static_rw_lock_init (&ebsdb->priv->rwlock);
+ g_rw_lock_init (&ebsdb->priv->rwlock);
ebsdb->priv->in_transaction = 0;
- ebsdb->priv->in_transaction_lock = g_mutex_new ();
+ g_mutex_init (&ebsdb->priv->in_transaction_lock);
}
static void
g_return_val_if_fail (ebsdb->priv != NULL, FALSE);
g_return_val_if_fail (ebsdb->priv->db != NULL, FALSE);
- g_mutex_lock (ebsdb->priv->in_transaction_lock);
+ g_mutex_lock (&ebsdb->priv->in_transaction_lock);
ebsdb->priv->in_transaction++;
if (ebsdb->priv->in_transaction == 0) {
- g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+ g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
g_return_val_if_fail (ebsdb->priv->in_transaction != 0, FALSE);
return FALSE;
res = book_backend_sql_exec (ebsdb->priv->db, "BEGIN", NULL, NULL, error);
}
- g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+ g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
return res;
}
g_return_val_if_fail (ebsdb->priv != NULL, FALSE);
g_return_val_if_fail (ebsdb->priv->db != NULL, FALSE);
- g_mutex_lock (ebsdb->priv->in_transaction_lock);
+ g_mutex_lock (&ebsdb->priv->in_transaction_lock);
if (ebsdb->priv->in_transaction == 0) {
- g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+ g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
g_return_val_if_fail (ebsdb->priv->in_transaction > 0, FALSE);
return FALSE;
WRITER_UNLOCK (ebsdb);
}
- g_mutex_unlock (ebsdb->priv->in_transaction_lock);
+ g_mutex_unlock (&ebsdb->priv->in_transaction_lock);
return res;
}
g_return_val_if_fail (folderid != NULL, NULL);
g_return_val_if_fail (folder_name != NULL, NULL);
- g_static_mutex_lock (&dbcon_lock);
+ g_mutex_lock (&dbcon_lock);
hash_key = g_strdup_printf ("%s@%s", emailid, path);
if (db_connections != NULL) {
if (ebsdb) {
g_object_ref (ebsdb);
- g_static_mutex_unlock (&dbcon_lock);
+ g_mutex_unlock (&dbcon_lock);
g_free (hash_key);
goto exit;
}
ebsdb->priv->path = g_strdup (path);
ebsdb->priv->store_vcard = store_vcard;
if (g_mkdir_with_parents (path, 0777) < 0) {
- g_static_mutex_unlock (&dbcon_lock);
+ g_mutex_unlock (&dbcon_lock);
g_set_error (
error, E_BOOK_SDB_ERROR, 0,
"Can not make parent directory: errno %d", errno);
filename = g_build_filename (path, DB_FILENAME, NULL);
if (!book_backend_sqlitedb_load (ebsdb, filename, &err)) {
- g_static_mutex_unlock (&dbcon_lock);
+ g_mutex_unlock (&dbcon_lock);
g_propagate_error (error, err);
g_object_unref (ebsdb);
g_free (filename);
g_hash_table_insert (db_connections, hash_key, ebsdb);
ebsdb->priv->hash_key = g_strdup (hash_key);
- g_static_mutex_unlock (&dbcon_lock);
+ g_mutex_unlock (&dbcon_lock);
exit:
if (!err)
struct _EBookBackendPrivate {
ESourceRegistry *registry;
- GMutex *clients_mutex;
+ GMutex clients_mutex;
GList *clients;
gboolean opening, opened, readonly, removed, online;
- GMutex *views_mutex;
+ GMutex views_mutex;
GList *views;
gchar *cache_dir;
g_list_free (priv->clients);
- g_mutex_free (priv->clients_mutex);
- g_mutex_free (priv->views_mutex);
+ g_mutex_clear (&priv->clients_mutex);
+ g_mutex_clear (&priv->views_mutex);
g_free (priv->cache_dir);
backend->priv = E_BOOK_BACKEND_GET_PRIVATE (backend);
backend->priv->clients = NULL;
- backend->priv->clients_mutex = g_mutex_new ();
+ g_mutex_init (&backend->priv->clients_mutex);
backend->priv->views = NULL;
- backend->priv->views_mutex = g_mutex_new ();
+ g_mutex_init (&backend->priv->views_mutex);
}
/**
g_return_if_fail (E_IS_BOOK_BACKEND (backend));
g_return_if_fail (E_IS_DATA_BOOK (book));
- g_mutex_lock (backend->priv->clients_mutex);
+ g_mutex_lock (&backend->priv->clients_mutex);
if (e_book_backend_is_opened (backend)) {
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
e_data_book_report_readonly (book, backend->priv->readonly);
e_data_book_report_online (book, backend->priv->online);
e_book_backend_respond_opened (backend, book, opid, NULL);
} else if (e_book_backend_is_opening (backend)) {
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
e_data_book_respond_open (book, opid, EDB_OPENING_ERROR);
} else {
backend->priv->opening = TRUE;
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
/* Subclasses may need to call e_book_backend_get_cache_dir() in
* their open() methods, so get the "cache-dir" property
{
g_return_if_fail (E_IS_BOOK_BACKEND (backend));
- g_mutex_lock (backend->priv->views_mutex);
+ g_mutex_lock (&backend->priv->views_mutex);
g_object_ref (view);
backend->priv->views = g_list_append (backend->priv->views, view);
- g_mutex_unlock (backend->priv->views_mutex);
+ g_mutex_unlock (&backend->priv->views_mutex);
}
/**
{
g_return_if_fail (E_IS_BOOK_BACKEND (backend));
- g_mutex_lock (backend->priv->views_mutex);
+ g_mutex_lock (&backend->priv->views_mutex);
backend->priv->views = g_list_remove (backend->priv->views, view);
g_object_unref (view);
- g_mutex_unlock (backend->priv->views_mutex);
+ g_mutex_unlock (&backend->priv->views_mutex);
}
/**
g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
g_return_val_if_fail (E_IS_DATA_BOOK (book), FALSE);
- g_mutex_lock (backend->priv->clients_mutex);
+ g_mutex_lock (&backend->priv->clients_mutex);
backend->priv->clients = g_list_prepend (backend->priv->clients, book);
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
return TRUE;
}
g_object_ref (backend);
/* Disconnect */
- g_mutex_lock (backend->priv->clients_mutex);
+ g_mutex_lock (&backend->priv->clients_mutex);
backend->priv->clients = g_list_remove (backend->priv->clients, book);
if (backend->priv->clients == NULL)
backend->priv->opening = FALSE;
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
g_object_unref (backend);
}
g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
- g_mutex_lock (backend->priv->views_mutex);
+ g_mutex_lock (&backend->priv->views_mutex);
/* XXX Use g_list_copy_deep() once we require GLib >= 2.34. */
list = g_list_copy (backend->priv->views);
g_list_foreach (list, (GFunc) g_object_ref, NULL);
- g_mutex_unlock (backend->priv->views_mutex);
+ g_mutex_unlock (&backend->priv->views_mutex);
return list;
}
priv = backend->priv;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_book_report_error (E_DATA_BOOK (clients->data), message);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
priv = backend->priv;
priv->readonly = is_readonly;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_book_report_readonly (E_DATA_BOOK (clients->data), is_readonly);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
priv = backend->priv;
priv->online = is_online;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_book_report_online (E_DATA_BOOK (clients->data), is_online);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
GList *clients;
priv = backend->priv;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
priv->opening = FALSE;
priv->opened = error == NULL;
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_book_report_opened (E_DATA_BOOK (clients->data), error);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
if (error)
g_error_free (error);
g_return_if_fail (prop_value != NULL);
priv = backend->priv;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_book_report_backend_property_changed (E_DATA_BOOK (clients->data), prop_name, prop_value);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
ESourceRegistry *registry;
EGdbusBookFactory *gdbus_object;
- GMutex *books_lock;
+ GMutex books_lock;
/* A hash of object paths for book URIs to EDataBooks */
GHashTable *books;
- GMutex *connections_lock;
+ GMutex connections_lock;
/* This is a hash of client addresses to GList* of EDataBooks */
GHashTable *connections;
d (g_debug ("in factory %p (%p) is dead", factory, dead));
- g_mutex_lock (priv->books_lock);
- g_mutex_lock (priv->connections_lock);
+ g_mutex_lock (&priv->books_lock);
+ g_mutex_lock (&priv->connections_lock);
g_hash_table_foreach_remove (
priv->books, remove_dead_pointer_cb, dead);
}
}
- g_mutex_unlock (priv->connections_lock);
- g_mutex_unlock (priv->books_lock);
+ g_mutex_unlock (&priv->connections_lock);
+ g_mutex_unlock (&priv->books_lock);
e_dbus_server_release (E_DBUS_SERVER (factory));
}
connection, object_path, &error);
if (book != NULL) {
- g_mutex_lock (priv->books_lock);
+ g_mutex_lock (&priv->books_lock);
g_hash_table_insert (
priv->books, g_strdup (object_path), book);
- g_mutex_unlock (priv->books_lock);
+ g_mutex_unlock (&priv->books_lock);
e_book_backend_add_client (E_BOOK_BACKEND (backend), book);
book_freed_cb, factory);
/* Update the hash of open connections. */
- g_mutex_lock (priv->connections_lock);
+ g_mutex_lock (&priv->connections_lock);
list = g_hash_table_lookup (priv->connections, sender);
list = g_list_prepend (list, book);
g_hash_table_insert (
priv->connections, g_strdup (sender), list);
- g_mutex_unlock (priv->connections_lock);
+ g_mutex_unlock (&priv->connections_lock);
}
g_object_unref (backend);
g_hash_table_destroy (priv->books);
g_hash_table_destroy (priv->connections);
- g_mutex_free (priv->books_lock);
- g_mutex_free (priv->connections_lock);
+ g_mutex_clear (&priv->books_lock);
+ g_mutex_clear (&priv->connections_lock);
#ifdef HAVE_GOA
g_hash_table_destroy (priv->goa_accounts);
priv = E_DATA_BOOK_FACTORY_GET_PRIVATE (server);
- g_mutex_lock (priv->connections_lock);
+ g_mutex_lock (&priv->connections_lock);
while (g_hash_table_lookup_extended (
priv->connections,
g_list_free (copy);
}
- g_mutex_unlock (priv->connections_lock);
+ g_mutex_unlock (&priv->connections_lock);
/* Chain up to parent's bus_name_lost() method. */
E_DBUS_SERVER_CLASS (e_data_book_factory_parent_class)->
factory->priv->gdbus_object, "handle-get-book",
G_CALLBACK (impl_BookFactory_get_book), factory);
- factory->priv->books_lock = g_mutex_new ();
+ g_mutex_init (&factory->priv->books_lock);
factory->priv->books = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) NULL);
- factory->priv->connections_lock = g_mutex_new ();
+ g_mutex_init (&factory->priv->connections_lock);
factory->priv->connections = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
gboolean running;
gboolean complete;
- GMutex *pending_mutex;
+ GMutex pending_mutex;
GArray *adds;
GArray *changes;
{
EDataBookView *view = data;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
view->priv->flush_id = 0;
send_pending_changes (view);
send_pending_removes (view);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
return FALSE;
}
priv->sexp = NULL;
}
- g_mutex_lock (priv->pending_mutex);
+ g_mutex_lock (&priv->pending_mutex);
if (priv->flush_id > 0) {
g_source_remove (priv->flush_id);
priv->flush_id = 0;
}
- g_mutex_unlock (priv->pending_mutex);
+ g_mutex_unlock (&priv->pending_mutex);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_data_book_view_parent_class)->dispose (object);
if (priv->fields_of_interest)
g_hash_table_destroy (priv->fields_of_interest);
- g_mutex_free (priv->pending_mutex);
+ g_mutex_clear (&priv->pending_mutex);
g_hash_table_destroy (priv->ids);
view->priv->fields_of_interest = NULL;
view->priv->running = FALSE;
view->priv->complete = FALSE;
- view->priv->pending_mutex = g_mutex_new ();
+ g_mutex_init (&view->priv->pending_mutex);
/* THRESHOLD_ITEMS * 2 because we store UID and vcard */
view->priv->adds = g_array_sized_new (
if (!view->priv->running)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
id = e_contact_get_const ((EContact *) contact, E_CONTACT_UID);
/* else nothing; we're removing a card that wasn't there */
}
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (!view->priv->running)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
contact = e_contact_new_from_vcard_with_uid (vcard, id);
currently_in_view = id_is_in_view (view, id);
/* Do this last so that id is still valid when notify_ is called */
g_object_unref (contact);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (!view->priv->running)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
currently_in_view = id_is_in_view (view, id);
else
notify_add (view, id, vcard);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (!view->priv->running)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
if (id_is_in_view (view, id))
notify_remove (view, id);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
/* View is complete */
view->priv->complete = TRUE;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
send_pending_adds (view);
send_pending_changes (view);
send_pending_removes (view);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
strv_error = e_gdbus_templates_encode_error (error);
e_gdbus_book_view_emit_complete (
EBookBackend *backend;
gchar *object_path;
- GStaticRecMutex pending_ops_lock;
+ GRecMutex pending_ops_lock;
GHashTable *pending_ops; /* opid to GCancellable for still running operations */
};
g_free (op->d.query);
break;
case OP_CANCEL_OPERATION:
- g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
+ g_rec_mutex_lock (&op->book->priv->pending_ops_lock);
if (g_hash_table_lookup (op->book->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
GCancellable *cancellable = g_hash_table_lookup (op->book->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
g_cancellable_cancel (cancellable);
}
- g_static_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
break;
case OP_CLOSE:
/* close just cancels all pending ops and frees data book */
e_book_backend_remove_client (backend, op->book);
case OP_CANCEL_ALL:
- g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
+ g_rec_mutex_lock (&op->book->priv->pending_ops_lock);
g_hash_table_foreach (op->book->priv->pending_ops, cancel_ops_cb, NULL);
- g_static_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
break;
}
data->id = e_operation_pool_reserve_opid (ops_pool);
data->cancellable = g_cancellable_new ();
- g_static_rec_mutex_lock (&book->priv->pending_ops_lock);
+ g_rec_mutex_lock (&book->priv->pending_ops_lock);
g_hash_table_insert (book->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
- g_static_rec_mutex_unlock (&book->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&book->priv->pending_ops_lock);
return data;
}
e_operation_pool_release_opid (ops_pool, opid);
- g_static_rec_mutex_lock (&book->priv->pending_ops_lock);
+ g_rec_mutex_lock (&book->priv->pending_ops_lock);
g_hash_table_remove (book->priv->pending_ops, GUINT_TO_POINTER (opid));
- g_static_rec_mutex_unlock (&book->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&book->priv->pending_ops_lock);
}
/**
priv->pending_ops = NULL;
}
- g_static_rec_mutex_free (&priv->pending_ops_lock);
+ g_rec_mutex_clear (&priv->pending_ops_lock);
if (priv->dbus_interface) {
g_object_unref (priv->dbus_interface);
ebook->priv->dbus_interface = e_gdbus_book_stub_new ();
ebook->priv->pending_ops = g_hash_table_new_full (
g_direct_hash, g_direct_equal, NULL, g_object_unref);
- g_static_rec_mutex_init (&ebook->priv->pending_ops_lock);
+ g_rec_mutex_init (&ebook->priv->pending_ops_lock);
dbus_interface = ebook->priv->dbus_interface;
g_signal_connect (
gboolean opened;
/* lock to indicate a busy state */
- GMutex *busy_lock;
+ GMutex busy_lock;
/* cond to synch threads */
- GCond *cond;
+ GCond cond;
/* cond to know the slave gone */
- GCond *slave_gone_cond;
+ GCond slave_gone_cond;
/* BG synch thread */
const GThread *synch_slave; /* just for a reference, whether thread exists */
/* not sure what can happen, but do not need to guess for ever,
* thus report success and update the calendar to get fresh info */
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
- g_cond_signal (cbdav->priv->cond);
+ g_cond_signal (&cbdav->priv->cond);
}
}
}
g_return_if_fail (E_IS_CAL_BACKEND_CALDAV (cbdav));
- g_cond_signal (cbdav->priv->cond);
+ g_cond_signal (&cbdav->priv->cond);
}
/* ************************************************************************* */
cbdav = E_CAL_BACKEND_CALDAV (data);
- g_mutex_lock (cbdav->priv->busy_lock);
+ g_mutex_lock (&cbdav->priv->busy_lock);
know_unreachable = !cbdav->priv->opened;
while (cbdav->priv->slave_cmd != SLAVE_SHOULD_DIE) {
if (cbdav->priv->slave_cmd == SLAVE_SHOULD_SLEEP) {
/* just sleep until we get woken up again */
- g_cond_wait (cbdav->priv->cond, cbdav->priv->busy_lock);
+ g_cond_wait (&cbdav->priv->cond, &cbdav->priv->busy_lock);
/* check if we should die, work or sleep again */
continue;
if (caldav_server_open_calendar (cbdav, &server_unreachable, &local_error)) {
cbdav->priv->opened = TRUE;
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
- g_cond_signal (cbdav->priv->cond);
+ g_cond_signal (&cbdav->priv->cond);
cbdav->priv->is_google = is_google_uri (cbdav->priv->uri);
know_unreachable = FALSE;
cbdav->priv->slave_busy = FALSE;
/* puhh that was hard, get some rest :) */
- g_cond_wait (cbdav->priv->cond, cbdav->priv->busy_lock);
+ g_cond_wait (&cbdav->priv->cond, &cbdav->priv->busy_lock);
}
/* signal we are done */
- g_cond_signal (cbdav->priv->slave_gone_cond);
+ g_cond_signal (&cbdav->priv->slave_gone_cond);
cbdav->priv->synch_slave = NULL;
/* we got killed ... */
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
return NULL;
}
GThread *slave;
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);
- slave = g_thread_create (caldav_synch_slave_loop, cbdav, FALSE, NULL);
-
- if (slave == NULL) {
- g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create synch slave thread")));
- }
+ slave = g_thread_new (NULL, caldav_synch_slave_loop, cbdav);
cbdav->priv->synch_slave = slave;
+ g_thread_unref (slave);
}
if (cbdav->priv->refresh_id == 0) {
if (success) {
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
- g_cond_signal (cbdav->priv->cond);
+ g_cond_signal (&cbdav->priv->cond);
cbdav->priv->is_google = is_google_uri (cbdav->priv->uri);
} else if (server_unreachable) {
cbdav = E_CAL_BACKEND_CALDAV (backend);
- g_mutex_lock (cbdav->priv->busy_lock);
+ g_mutex_lock (&cbdav->priv->busy_lock);
/* let it decide the 'getctag' extension availability again */
cbdav->priv->ctag_supported = TRUE;
if (!cbdav->priv->loaded && !initialize_backend (cbdav, perror)) {
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
return;
}
online = e_backend_get_online (E_BACKEND (backend));
if (!cbdav->priv->do_offline && !online) {
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
return;
}
E_CAL_BACKEND (backend), cbdav->priv->read_only);
e_cal_backend_notify_online (E_CAL_BACKEND (backend), online);
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
}
static void
cbdav = E_CAL_BACKEND_CALDAV (backend);
- g_mutex_lock (cbdav->priv->busy_lock);
+ g_mutex_lock (&cbdav->priv->busy_lock);
if (!cbdav->priv->loaded
|| cbdav->priv->slave_cmd == SLAVE_SHOULD_DIE
|| !check_state (cbdav, &online, NULL)
|| !online) {
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
return;
}
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
/* wake it up */
- g_cond_signal (cbdav->priv->cond);
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_cond_signal (&cbdav->priv->cond);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
}
static void
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP); \
} \
\
- g_mutex_lock (cbdav->priv->busy_lock); \
+ g_mutex_lock (&cbdav->priv->busy_lock); \
_call_func _call_params; \
\
/* this is done before unlocking */ \
if (was_slave_busy) { \
update_slave_cmd (cbdav->priv, old_slave_cmd); \
- g_cond_signal (cbdav->priv->cond); \
+ g_cond_signal (&cbdav->priv->cond); \
} \
\
- g_mutex_unlock (cbdav->priv->busy_lock); \
+ g_mutex_unlock (&cbdav->priv->busy_lock); \
}
caldav_busy_stub (
cbdav = E_CAL_BACKEND_CALDAV (backend);
- /*g_mutex_lock (cbdav->priv->busy_lock);*/
+ /*g_mutex_lock (&cbdav->priv->busy_lock);*/
online = e_backend_get_online (E_BACKEND (backend));
if (!cbdav->priv->loaded) {
e_cal_backend_notify_online (backend, online);
- /*g_mutex_unlock (cbdav->priv->busy_lock);*/
+ /*g_mutex_unlock (&cbdav->priv->busy_lock);*/
return;
}
if (online) {
/* Wake up the slave thread */
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_WORK);
- g_cond_signal (cbdav->priv->cond);
+ g_cond_signal (&cbdav->priv->cond);
} else {
soup_session_abort (cbdav->priv->session);
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);
e_cal_backend_notify_online (backend, online);
- /*g_mutex_unlock (cbdav->priv->busy_lock);*/
+ /*g_mutex_unlock (&cbdav->priv->busy_lock);*/
}
static icaltimezone *
old_slave_busy = cbdav->priv->slave_busy;
if (old_slave_busy) {
update_slave_cmd (cbdav->priv, SLAVE_SHOULD_SLEEP);
- g_mutex_lock (cbdav->priv->busy_lock);
+ g_mutex_lock (&cbdav->priv->busy_lock);
}
initialize_backend (cbdav, NULL);
/* always wakeup thread, even when it was sleeping */
- g_cond_signal (cbdav->priv->cond);
+ g_cond_signal (&cbdav->priv->cond);
if (old_slave_busy) {
update_slave_cmd (cbdav->priv, old_slave_cmd);
- g_mutex_unlock (cbdav->priv->busy_lock);
+ g_mutex_unlock (&cbdav->priv->busy_lock);
}
cbdav->priv->updating_source = FALSE;
* as it can work at the moment, and lock can be locked */
update_slave_cmd (priv, SLAVE_SHOULD_DIE);
- g_mutex_lock (priv->busy_lock);
+ g_mutex_lock (&priv->busy_lock);
if (priv->disposed) {
- g_mutex_unlock (priv->busy_lock);
+ g_mutex_unlock (&priv->busy_lock);
return;
}
/* stop the slave */
if (priv->synch_slave) {
- g_cond_signal (priv->cond);
+ g_cond_signal (&priv->cond);
/* wait until the slave died */
- g_cond_wait (priv->slave_gone_cond, priv->busy_lock);
+ g_cond_wait (&priv->slave_gone_cond, &priv->busy_lock);
}
g_object_unref (priv->session);
}
priv->disposed = TRUE;
- g_mutex_unlock (priv->busy_lock);
+ g_mutex_unlock (&priv->busy_lock);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
priv = E_CAL_BACKEND_CALDAV_GET_PRIVATE (object);
- g_mutex_free (priv->busy_lock);
- g_cond_free (priv->cond);
- g_cond_free (priv->slave_gone_cond);
+ g_mutex_clear (&priv->busy_lock);
+ g_cond_clear (&priv->cond);
+ g_cond_clear (&priv->slave_gone_cond);
g_free (priv->password);
cbdav->priv->is_google = FALSE;
- cbdav->priv->busy_lock = g_mutex_new ();
- cbdav->priv->cond = g_cond_new ();
- cbdav->priv->slave_gone_cond = g_cond_new ();
+ g_mutex_init (&cbdav->priv->busy_lock);
+ g_cond_init (&cbdav->priv->cond);
+ g_cond_init (&cbdav->priv->slave_gone_cond);
/* Slave control ... */
cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;
typedef struct _BookRecord {
volatile gint ref_count;
- GMutex *lock;
+ GMutex lock;
ECalBackendContacts *cbc;
EBookClient *book_client;
EBookClientView *book_view;
br = g_slice_new0 (BookRecord);
br->ref_count = 1;
- br->lock = g_mutex_new ();
+ g_mutex_init (&br->lock);
br->cbc = g_object_ref (cbc);
br->book_client = book_client; /* takes ownership */
br->cbc->priv->tracked_contacts,
remove_by_book, br->book_client);
- g_mutex_free (br->lock);
+ g_mutex_clear (&br->lock);
g_object_unref (br->cbc);
g_object_unref (br->book_client);
{
g_return_if_fail (br != NULL);
- g_mutex_lock (br->lock);
+ g_mutex_lock (&br->lock);
if (book_view != NULL)
g_object_ref (book_view);
br->book_view = book_view;
- g_mutex_unlock (br->lock);
+ g_mutex_unlock (&br->lock);
}
static void
static void
cbc_reopen_book_client (BookRecord *br)
{
- GError *error = NULL;
+ GThread *thread;
- g_mutex_lock (br->lock);
+ g_mutex_lock (&br->lock);
g_warn_if_fail (br->book_client_opened_id == 0);
br->book_client_opened_id = g_signal_connect (
br->book_client, "opened",
G_CALLBACK (book_client_opened_cb), br);
- g_thread_create (
+ thread = g_thread_new (NULL,
cbc_reopen_book_client_thread,
- br->book_client, FALSE, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Cannot create thread to reload source! (%s)",
- G_STRFUNC, error->message);
- g_error_free (error);
- }
+ br->book_client);
+ g_thread_unref (thread);
- g_mutex_unlock (br->lock);
+ g_mutex_unlock (&br->lock);
}
static void
g_return_if_fail (book_client != NULL);
g_return_if_fail (br != NULL);
- g_mutex_lock (br->lock);
+ g_mutex_lock (&br->lock);
g_signal_handler_disconnect (
br->book_client,
br->book_client_opened_id);
br->book_client_opened_id = 0;
- g_mutex_unlock (br->lock);
+ g_mutex_unlock (&br->lock);
source = e_client_get_source (E_CLIENT (book_client));
source_uid = e_source_get_uid (source);
if (error != NULL) {
ESource *source;
- g_mutex_lock (br->lock);
+ g_mutex_lock (&br->lock);
g_signal_handler_disconnect (
br->book_client,
br->book_client_opened_id);
br->book_client_opened_id = 0;
- g_mutex_unlock (br->lock);
+ g_mutex_unlock (&br->lock);
g_warning (
"%s: Failed to open book: %s",
* may call other high-level functions the mutex must allow
* recursive locking
*/
- GStaticRecMutex idle_save_rmutex;
+ GRecMutex idle_save_rmutex;
/* Toplevel VCALENDAR component */
icalcomponent *icalcomp;
GList *comp;
/* guards refresh members */
- GMutex *refresh_lock;
+ GMutex refresh_lock;
/* set to TRUE to indicate thread should stop */
gboolean refresh_thread_stop;
/* condition for refreshing, not NULL when thread exists */
g_assert (priv->path != NULL);
g_assert (priv->icalcomp != NULL);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (!priv->is_dirty || priv->read_only) {
priv->dirty_idle_id = 0;
priv->is_dirty = FALSE;
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
return FALSE;
}
priv->is_dirty = FALSE;
priv->dirty_idle_id = 0;
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
return FALSE;
error_malformed_uri:
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
e_cal_backend_notify_error (E_CAL_BACKEND (cbfile),
_("Cannot save calendar data: Malformed URI."));
return FALSE;
error:
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
if (e) {
gchar *msg = g_strdup_printf ("%s: %s", _("Cannot save calendar data"), e->message);
priv = cbfile->priv;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
priv->is_dirty = TRUE;
if (!priv->dirty_idle_id)
priv->dirty_idle_id = g_idle_add ((GSourceFunc) save_file_when_idle, cbfile);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
}
static void
free_refresh_data (E_CAL_BACKEND_FILE (object));
- if (priv->refresh_lock)
- g_mutex_free (priv->refresh_lock);
+ g_mutex_clear (&priv->refresh_lock);
- g_static_rec_mutex_free (&priv->idle_save_rmutex);
+ g_rec_mutex_clear (&priv->idle_save_rmutex);
g_free (priv->path);
g_free (priv->file_name);
last_modified = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
g_object_unref (info);
- g_mutex_lock (priv->refresh_lock);
+ g_mutex_lock (&priv->refresh_lock);
while (!priv->refresh_thread_stop) {
- g_cond_wait (priv->refresh_cond, priv->refresh_lock);
+ g_cond_wait (priv->refresh_cond, &priv->refresh_lock);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (priv->refresh_skip > 0) {
priv->refresh_skip--;
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
continue;
}
priv->refresh_skip = 0;
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (!info)
g_object_unref (file);
g_cond_signal (priv->refresh_gone_cond);
- g_mutex_unlock (priv->refresh_lock);
+ g_mutex_unlock (&priv->refresh_lock);
return NULL;
}
priv = cbfile->priv;
- g_mutex_lock (priv->refresh_lock);
+ g_mutex_lock (&priv->refresh_lock);
priv->refresh_thread_stop = FALSE;
priv->refresh_skip = 0;
}
if (priv->refresh_monitor) {
- priv->refresh_cond = g_cond_new ();
- priv->refresh_gone_cond = g_cond_new ();
+ GThread *thread;
- g_thread_create (refresh_thread_func, cbfile, FALSE, NULL);
+ priv->refresh_cond = g_new0 (GCond, 1);
+ priv->refresh_gone_cond = g_new0 (GCond, 1);
+
+ thread = g_thread_new (NULL, refresh_thread_func, cbfile);
+ g_thread_unref (thread);
}
- g_mutex_unlock (priv->refresh_lock);
+ g_mutex_unlock (&priv->refresh_lock);
}
static void
priv = cbfile->priv;
- g_mutex_lock (priv->refresh_lock);
+ g_mutex_lock (&priv->refresh_lock);
if (priv->refresh_monitor)
g_object_unref (priv->refresh_monitor);
if (priv->refresh_cond) {
priv->refresh_thread_stop = TRUE;
g_cond_signal (priv->refresh_cond);
- g_cond_wait (priv->refresh_gone_cond, priv->refresh_lock);
+ g_cond_wait (priv->refresh_gone_cond, &priv->refresh_lock);
- g_cond_free (priv->refresh_cond);
+ g_cond_clear (priv->refresh_cond);
priv->refresh_cond = NULL;
- g_cond_free (priv->refresh_gone_cond);
+ g_cond_clear (priv->refresh_gone_cond);
priv->refresh_gone_cond = NULL;
}
priv->refresh_skip = 0;
- g_mutex_unlock (priv->refresh_lock);
+ g_mutex_unlock (&priv->refresh_lock);
}
/* Parses an open iCalendar file and loads it into the backend */
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
/* Claim a succesful open if we are already open */
if (priv->path && priv->comp_uid_hash) {
g_free (str_uri);
done:
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), priv->read_only);
e_cal_backend_notify_online (E_CAL_BACKEND (backend), TRUE);
e_return_data_cal_error_if_fail (uid != NULL, ObjectNotFound);
g_assert (priv->comp_uid_hash != NULL);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
if (!obj_data) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
struct icaltimetype itt;
if (!obj_data->full_object) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
e_cal_component_get_icalcomponent (obj_data->full_object),
itt);
if (!icalcomp) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
*object = e_cal_component_get_as_string (obj_data->full_object);
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
}
/* Add_timezone handler for the file backend */
zone = icaltimezone_new ();
icaltimezone_set_component (zone, tz_comp);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (!icalcomponent_get_timezone (priv->icalcomp,
icaltimezone_get_tzid (zone))) {
icalcomponent_add_component (priv->icalcomp, tz_comp);
save (cbfile, TRUE);
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
icaltimezone_free (zone, 1);
}
return;
}
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (
match_data.obj_sexp,
&match_data);
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
*objects = g_slist_reverse (match_data.comps_list);
e_return_data_cal_error_if_fail (attachment_uris != NULL, InvalidArg);
g_assert (priv->comp_uid_hash != NULL);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
if (!obj_data) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
struct icaltimetype itt;
if (!obj_data->full_object) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
e_cal_component_get_icalcomponent (obj_data->full_object),
itt);
if (!icalcomp) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
*attachment_uris = g_slist_reverse (*attachment_uris);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
}
/* get_query handler for the file backend */
objs_occuring_in_tw = NULL;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (!prunning_by_time) {
/* full scan */
g_list_length (objs_occuring_in_tw));
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
/* notify listeners of all objects */
if (match_data.comps_list) {
e_return_data_cal_error_if_fail (start != -1 && end != -1, InvalidRange);
e_return_data_cal_error_if_fail (start <= end, InvalidRange);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
*freebusy = NULL;
}
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
}
static icaltimezone *
g_return_val_if_fail (priv->icalcomp != NULL, NULL);
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (!strcmp (tzid, "UTC"))
zone = icaltimezone_get_utc_timezone ();
zone = E_CAL_BACKEND_CLASS (e_cal_backend_file_parent_class)->internal_get_timezone (backend, tzid);
}
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
return zone;
}
if (uids)
*uids = NULL;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
/* First step, parse input strings and do uid verification: may fail */
for (l = in_calobjs; l; l = l->next) {
icalcomp = icalparser_parse_string ((gchar *) l->data);
if (!icalcomp) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (InvalidObject));
return;
}
/* Check kind with the parent */
if (icalcomponent_isa (icalcomp) != e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (InvalidObject));
return;
}
new_uid = e_cal_component_gen_uid ();
if (!new_uid) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (InvalidObject));
return;
}
/* check that the object is not in our cache */
if (uid_in_use (cbfile, comp_uid)) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectIdAlreadyExists));
return;
}
/* Save the file */
save (cbfile, TRUE);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
if (uids)
*uids = g_slist_reverse (*uids);
if (new_components)
*new_components = NULL;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
/* First step, parse input strings and do uid verification: may fail */
for (l = calobjs; l; l = l->next) {
icalcomp = icalparser_parse_string (l->data);
if (!icalcomp) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (InvalidObject));
return;
}
/* Check kind with the parent */
if (icalcomponent_isa (icalcomp) != e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (InvalidObject));
return;
}
/* Get the object from our cache */
if (!g_hash_table_lookup (priv->comp_uid_hash, comp_uid)) {
g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
/* All the components were updated, now we save the file */
save (cbfile, TRUE);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
if (old_components)
*old_components = g_slist_reverse (*old_components);
*old_components = *new_components = NULL;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
/* First step, validate the input */
for (l = ids; l; l = l->next) {
ECalComponentId *id = l->data;
/* Make the ID contains a uid */
if (!id || !id->uid) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
or CALOBJ_MOD_THISANDFUTURE */
if ((mod == CALOBJ_MOD_THISANDPRIOR || mod == CALOBJ_MOD_THISANDFUTURE) &&
(!id->rid || !*(id->rid))) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
/* Make sure the uid exists in the local hash table */
if (!g_hash_table_lookup (priv->comp_uid_hash, id->uid)) {
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
}
save (cbfile, TRUE);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
*old_components = g_slist_reverse (*old_components);
*new_components = g_slist_reverse (*new_components);
return;
}
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
registry = e_cal_backend_get_registry (E_CAL_BACKEND (backend));
error:
g_hash_table_destroy (tzdata.zones);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
if (err)
g_propagate_error (error, err);
cbfile->priv->file_name = g_strdup ("calendar.ics");
- g_static_rec_mutex_init (&cbfile->priv->idle_save_rmutex);
+ g_rec_mutex_init (&cbfile->priv->idle_save_rmutex);
- cbfile->priv->refresh_lock = g_mutex_new ();
+ g_mutex_init (&cbfile->priv->refresh_lock);
/*
* data access is serialized via idle_save_rmutex, so locking at the
g_return_if_fail (file_name != NULL);
priv = cbfile->priv;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (priv->file_name)
g_free (priv->file_name);
priv->file_name = g_strdup (file_name);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
}
const gchar *
GError *err = NULL;
priv = cbfile->priv;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
str_uri = get_uri_string (E_CAL_BACKEND (cbfile));
if (!str_uri) {
priv->read_only = TRUE;
}
done:
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
e_cal_backend_notify_readonly (E_CAL_BACKEND (cbfile), cbfile->priv->read_only);
if (err)
if (!match_data.obj_sexp)
return;
- g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+ g_rec_mutex_lock (&priv->idle_save_rmutex);
if (!match_data.obj_sexp)
{
g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) match_object_sexp,
&match_data);
- g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+ g_rec_mutex_unlock (&priv->idle_save_rmutex);
*objects = g_slist_reverse (match_data.comps_list);
((obj), E_TYPE_SOURCE_LOCAL, ESourceLocalPrivate))
struct _ESourceLocalPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
GFile *custom_file;
};
priv = E_SOURCE_LOCAL_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_source_local_parent_class)->finalize (object);
e_source_local_init (ESourceLocal *extension)
{
extension->priv = E_SOURCE_LOCAL_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
void
g_return_val_if_fail (E_IS_SOURCE_LOCAL (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_local_get_custom_file (extension);
duplicate = (protected != NULL) ? g_file_dup (protected) : NULL;
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
g_object_ref (custom_file);
}
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (extension->priv->custom_file != NULL)
g_object_unref (extension->priv->custom_file);
extension->priv->custom_file = custom_file;
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "custom-file");
}
((obj), E_TYPE_SOURCE_WEATHER, ESourceWeatherPrivate))
struct _ESourceWeatherPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
ESourceWeatherUnits units;
gchar *location;
};
priv = E_SOURCE_WEATHER_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->location);
e_source_weather_init (ESourceWeather *extension)
{
extension->priv = E_SOURCE_WEATHER_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
void
g_return_val_if_fail (E_IS_SOURCE_WEATHER (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_weather_get_location (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_WEATHER (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->location, location) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->location);
extension->priv->location = e_util_strdup_strip (location);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "location");
}
icaltimezone *default_zone;
gchar *cache_dir;
- GMutex *zone_cache_lock;
+ GMutex zone_cache_lock;
GHashTable *zone_cache;
};
static guint active_cal_clients = 0, cal_connection_closed_id = 0;
static EGdbusCalFactory *cal_factory = NULL;
-static GStaticRecMutex cal_factory_lock = G_STATIC_REC_MUTEX_INIT;
-#define LOCK_FACTORY() g_static_rec_mutex_lock (&cal_factory_lock)
-#define UNLOCK_FACTORY() g_static_rec_mutex_unlock (&cal_factory_lock)
+static GRecMutex cal_factory_lock;
+#define LOCK_FACTORY() g_rec_mutex_lock (&cal_factory_lock)
+#define UNLOCK_FACTORY() g_rec_mutex_unlock (&cal_factory_lock)
static void gdbus_cal_factory_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data);
icaltimezone_free (priv->default_zone, 1);
priv->default_zone = NULL;
- g_mutex_lock (priv->zone_cache_lock);
+ g_mutex_lock (&priv->zone_cache_lock);
g_hash_table_destroy (priv->zone_cache);
priv->zone_cache = NULL;
- g_mutex_unlock (priv->zone_cache_lock);
- g_mutex_free (priv->zone_cache_lock);
- priv->zone_cache_lock = NULL;
+ g_mutex_unlock (&priv->zone_cache_lock);
+ g_mutex_clear (&priv->zone_cache_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_cal_client_parent_class)->finalize (object);
client->priv->source_type = E_CAL_CLIENT_SOURCE_TYPE_LAST;
client->priv->default_zone = icaltimezone_get_utc_timezone ();
client->priv->cache_dir = NULL;
- client->priv->zone_cache_lock = g_mutex_new ();
+ g_mutex_init (&client->priv->zone_cache_lock);
client->priv->zone_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_zone_cb);
}
g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
g_return_val_if_fail (tzid != NULL, NULL);
g_return_val_if_fail (client->priv->zone_cache != NULL, NULL);
- g_return_val_if_fail (client->priv->zone_cache_lock != NULL, NULL);
if (!*tzid)
return NULL;
- g_mutex_lock (client->priv->zone_cache_lock);
+ g_mutex_lock (&client->priv->zone_cache_lock);
if (g_str_equal (tzid, "UTC")) {
zone = icaltimezone_get_utc_timezone ();
} else {
}
}
- g_mutex_unlock (client->priv->zone_cache_lock);
+ g_mutex_unlock (&client->priv->zone_cache_lock);
return zone;
}
res = FALSE;
g_propagate_error (error, e_cal_client_error_create (E_CAL_CLIENT_ERROR_INVALID_OBJECT, NULL));
} else {
- g_mutex_lock (client->priv->zone_cache_lock);
+ g_mutex_lock (&client->priv->zone_cache_lock);
g_hash_table_insert (client->priv->zone_cache, g_strdup (icaltimezone_get_tzid (*zone)), *zone);
- g_mutex_unlock (client->priv->zone_cache_lock);
+ g_mutex_unlock (&client->priv->zone_cache_lock);
}
} else {
res = FALSE;
static gchar *last_localtime_content = NULL;
static gsize last_localtime_content_len = -1;
static gchar *last_timezone = NULL;
- static GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
+ static GRecMutex mutex;
struct stat stat_localtime;
gchar *localtime_content = NULL;
NULL))
return NULL;
- g_static_rec_mutex_lock (&mutex);
+ g_rec_mutex_lock (&mutex);
if (last_localtime_content) {
if (localtime_content_len != last_localtime_content_len
last_timezone = NULL;
} else {
retval = g_strdup (last_timezone);
- g_static_rec_mutex_unlock (&mutex);
+ g_rec_mutex_unlock (&mutex);
g_free (localtime_content);
return retval;
g_free (localtime_content);
}
- g_static_rec_mutex_unlock (&mutex);
+ g_rec_mutex_unlock (&mutex);
return retval;
}
ECalSourceType type;
GList **free_busy_data;
- GMutex *free_busy_data_lock;
+ GMutex free_busy_data_lock;
};
enum {
priv->load_state = E_CAL_LOAD_NOT_LOADED;
if (priv->free_busy_data) {
- g_mutex_lock (priv->free_busy_data_lock);
+ g_mutex_lock (&priv->free_busy_data_lock);
g_list_foreach (*priv->free_busy_data, (GFunc) g_object_unref, NULL);
g_list_free (*priv->free_busy_data);
*priv->free_busy_data = NULL;
priv->free_busy_data = NULL;
- g_mutex_unlock (priv->free_busy_data_lock);
+ g_mutex_unlock (&priv->free_busy_data_lock);
}
- g_mutex_free (priv->free_busy_data_lock);
+ g_mutex_clear (&priv->free_busy_data_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_cal_parent_class)->finalize (object);
ecal->priv->load_state = E_CAL_LOAD_NOT_LOADED;
- ecal->priv->free_busy_data_lock = g_mutex_new ();
+ g_mutex_init (&ecal->priv->free_busy_data_lock);
}
static void async_open_report_result (ECal *ecal, const GError *error);
GHashTable *comp_uid_hash;
EFileCache *keys_cache;
- GStaticRWLock lock;
+ GRWLock lock;
gchar *cache_file_name;
gchar *key_file_name;
return FALSE;
}
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
if (obj == NULL) {
obj = create_new_full_object ();
}
g_object_ref (comp);
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
return TRUE;
}
gboolean ret_val = TRUE;
gboolean remove_completely = FALSE;
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
if (obj == NULL) {
g_hash_table_remove (fstore->priv->comp_uid_hash, uid);
end:
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
return ret_val;
FullCompObject *obj = NULL;
ECalComponent *comp = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
if (obj == NULL)
g_object_ref (comp);
end:
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return comp;
}
gboolean ret_val = FALSE;
FullCompObject *obj = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
if (obj == NULL) {
ret_val = TRUE;
end:
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return ret_val;
}
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
const icaltimezone *zone = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
zone = g_hash_table_lookup (fstore->priv->timezones, tzid);
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return zone;
}
g_return_val_if_fail (fstore != NULL, FALSE);
g_return_val_if_fail (zone != NULL, FALSE);
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
copy = copy_timezone ((icaltimezone *) zone);
g_hash_table_insert (
fstore->priv->timezones,
g_strdup (icaltimezone_get_tzid ((icaltimezone *) zone)),
copy);
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
fstore->priv->dirty = TRUE;
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
gboolean ret_val = FALSE;
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
ret_val = g_hash_table_remove (fstore->priv->timezones, tzid);
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
if (ret_val) {
fstore->priv->dirty = TRUE;
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
const gchar *value;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
value = e_file_cache_get_object (fstore->priv->keys_cache, key);
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return value;
}
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
gboolean ret_val = FALSE;
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
if (!value)
ret_val = e_file_cache_remove_object (
fstore->priv->keys_cache, key, value);
}
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
return ret_val;
}
const gchar *tzid;
const icaltimezone *zone = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
tzid = e_file_cache_get_object (
fstore->priv->keys_cache, "default-zone");
if (tzid)
zone = g_hash_table_lookup (fstore->priv->timezones, tzid);
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return zone;
}
icaltimezone *copy;
const gchar *key = "default-zone";
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
tzid = icaltimezone_get_tzid ((icaltimezone *) zone);
copy = copy_timezone ((icaltimezone *) zone);
e_file_cache_add_object (
fstore->priv->keys_cache, key, tzid);
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
return TRUE;
}
FullCompObject *obj = NULL;
GSList *comps = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
if (obj == NULL) {
g_hash_table_foreach (obj->recurrences, (GHFunc) add_comp_to_slist, &comps);
end:
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return comps;
}
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
GSList *comps = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
g_hash_table_foreach (
fstore->priv->comp_uid_hash,
(GHFunc) add_full_comp_to_slist, &comps);
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return comps;
}
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
GSList *comp_ids = NULL;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
g_hash_table_foreach (
fstore->priv->comp_uid_hash,
(GHFunc) add_comp_ids_to_slist, &comp_ids);
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
return comp_ids;
}
return;
}
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
g_hash_table_insert (fstore->priv->timezones, g_strdup (tzid), zone);
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
}
static icaltimezone *
{
ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
- g_static_rw_lock_writer_lock (&fstore->priv->lock);
+ g_rw_lock_writer_lock (&fstore->priv->lock);
e_file_cache_clean (fstore->priv->keys_cache);
g_hash_table_remove_all (fstore->priv->comp_uid_hash);
g_hash_table_remove_all (fstore->priv->timezones);
- g_static_rw_lock_writer_unlock (&fstore->priv->lock);
+ g_rw_lock_writer_unlock (&fstore->priv->lock);
save_cache (fstore);
return TRUE;
gsize len, nwrote;
FILE *f;
- g_static_rw_lock_reader_lock (&fstore->priv->lock);
+ g_rw_lock_reader_lock (&fstore->priv->lock);
fstore->priv->save_timeout_id = 0;
g_unlink (tmpfile);
error:
- g_static_rw_lock_reader_unlock (&fstore->priv->lock);
+ g_rw_lock_reader_unlock (&fstore->priv->lock);
g_free (tmpfile);
g_free (data);
return FALSE;
priv->dirty = FALSE;
priv->freeze_changes = FALSE;
- g_static_rw_lock_free (&priv->lock);
+ g_rw_lock_clear (&priv->lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_cal_backend_file_store_parent_class)->finalize (object);
(GDestroyNotify) g_free,
(GDestroyNotify) destroy_full_object);
store->priv->keys_cache = NULL;
- g_static_rw_lock_init (&store->priv->lock);
+ g_rw_lock_init (&store->priv->lock);
store->priv->cache_file_name = NULL;
store->priv->key_file_name = NULL;
store->priv->dirty = FALSE;
EIntervalNode *root;
EIntervalNode *nil;
GHashTable *id_node_hash;
- GStaticRecMutex mutex;
+ GRecMutex mutex;
};
static inline gint
priv = tree->priv;
- g_static_rec_mutex_lock (&priv->mutex);
+ g_rec_mutex_lock (&priv->mutex);
e_cal_component_get_uid (comp, &uid);
rid = e_cal_component_get_recurid_as_string (comp);
g_hash_table_insert (priv->id_node_hash, component_key (uid, rid), newNode);
g_free (rid);
- g_static_rec_mutex_unlock (&priv->mutex);
+ g_rec_mutex_unlock (&priv->mutex);
return TRUE;
}
g_return_val_if_fail (tree != NULL, NULL);
priv = tree->priv;
- g_static_rec_mutex_lock (&priv->mutex);
+ g_rec_mutex_lock (&priv->mutex);
stack_start = pos = g_list_insert (stack_start, priv->root->left, -1);
g_list_free (stack_start);
- g_static_rec_mutex_unlock (&priv->mutex);
+ g_rec_mutex_unlock (&priv->mutex);
return list;
}
priv = tree->priv;
nil = priv->nil;
root = priv->root;
- g_static_rec_mutex_lock (&priv->mutex);
+ g_rec_mutex_lock (&priv->mutex);
z = e_intervaltree_search_component (tree, uid, rid);
if (!z || z == nil) {
- g_static_rec_mutex_unlock (&priv->mutex);
+ g_rec_mutex_unlock (&priv->mutex);
return FALSE;
}
g_object_unref (z->comp);
g_free (z);
- g_static_rec_mutex_unlock (&priv->mutex);
+ g_rec_mutex_unlock (&priv->mutex);
return TRUE;
}
priv->id_node_hash = NULL;
}
- g_static_rec_mutex_free (&priv->mutex);
+ g_rec_mutex_clear (&priv->mutex);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_intervaltree_parent_class)->finalize (object);
root->max = _TIME_MAX;
root->min = _TIME_MIN;
- g_static_rec_mutex_init (&tree->priv->mutex);
+ g_rec_mutex_init (&tree->priv->mutex);
tree->priv->id_node_hash = g_hash_table_new_full (
(GHashFunc) g_str_hash,
G_DEFINE_TYPE (ECalBackendSync, e_cal_backend_sync, E_TYPE_CAL_BACKEND)
struct _ECalBackendSyncPrivate {
- GMutex *sync_mutex;
+ GMutex sync_mutex;
gboolean mutex_lock;
};
gboolean locked = backend->priv->mutex_lock; \
e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func, NotSupported); \
if (locked) \
- g_mutex_lock (backend->priv->sync_mutex); \
+ g_mutex_lock (&backend->priv->sync_mutex); \
(* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func) args; \
if (locked) \
- g_mutex_unlock (backend->priv->sync_mutex); \
+ g_mutex_unlock (&backend->priv->sync_mutex); \
} G_STMT_END
#define LOCK_WRAPPER_RET_VAL(func, args) G_STMT_START { \
gboolean locked = backend->priv->mutex_lock; \
e_return_data_cal_error_val_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func, NotSupported); \
if (locked) \
- g_mutex_lock (backend->priv->sync_mutex); \
+ g_mutex_lock (&backend->priv->sync_mutex); \
res = (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func) args; \
if (locked) \
- g_mutex_unlock (backend->priv->sync_mutex); \
+ g_mutex_unlock (&backend->priv->sync_mutex); \
} G_STMT_END
/**
icaltimezone *zone = NULL;
if (backend->priv->mutex_lock)
- g_mutex_lock (backend->priv->sync_mutex);
+ g_mutex_lock (&backend->priv->sync_mutex);
zone = e_cal_backend_internal_get_timezone (E_CAL_BACKEND (backend), tzid);
if (backend->priv->mutex_lock)
- g_mutex_unlock (backend->priv->sync_mutex);
+ g_mutex_unlock (&backend->priv->sync_mutex);
if (!zone) {
g_propagate_error (error, e_data_cal_create_error (ObjectNotFound, NULL));
priv = E_CAL_BACKEND_SYNC_GET_PRIVATE (object);
- g_mutex_free (priv->sync_mutex);
+ g_mutex_clear (&priv->sync_mutex);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_cal_backend_sync_parent_class)->finalize (object);
e_cal_backend_sync_init (ECalBackendSync *backend)
{
backend->priv = E_CAL_BACKEND_SYNC_GET_PRIVATE (backend);
- backend->priv->sync_mutex = g_mutex_new ();
+ g_mutex_init (&backend->priv->sync_mutex);
}
gchar *cache_dir;
/* List of Cal objects */
- GMutex *clients_mutex;
+ GMutex clients_mutex;
GList *clients;
- GMutex *views_mutex;
+ GMutex views_mutex;
GList *views;
/* ECalBackend to pass notifications on to */
/* should be NULL, anyway */
g_list_free (priv->clients);
- g_mutex_free (priv->clients_mutex);
- g_mutex_free (priv->views_mutex);
+ g_mutex_clear (&priv->clients_mutex);
+ g_mutex_clear (&priv->views_mutex);
g_free (priv->cache_dir);
backend->priv = E_CAL_BACKEND_GET_PRIVATE (backend);
backend->priv->clients = NULL;
- backend->priv->clients_mutex = g_mutex_new ();
+ g_mutex_init (&backend->priv->clients_mutex);
backend->priv->views = NULL;
- backend->priv->views_mutex = g_mutex_new ();
+ g_mutex_init (&backend->priv->views_mutex);
backend->priv->readonly = TRUE;
}
g_object_weak_ref (G_OBJECT (cal), cal_destroy_cb, backend);
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
priv->clients = g_list_append (priv->clients, cal);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
static void
g_object_ref (backend);
/* Disconnect */
- g_mutex_lock (backend->priv->clients_mutex);
+ g_mutex_lock (&backend->priv->clients_mutex);
backend->priv->clients = g_list_remove (backend->priv->clients, cal);
if (backend->priv->clients == NULL)
backend->priv->opening = FALSE;
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
g_object_unref (backend);
}
g_return_if_fail (backend != NULL);
g_return_if_fail (E_IS_CAL_BACKEND (backend));
- g_mutex_lock (backend->priv->views_mutex);
+ g_mutex_lock (&backend->priv->views_mutex);
backend->priv->views = g_list_append (backend->priv->views, view);
- g_mutex_unlock (backend->priv->views_mutex);
+ g_mutex_unlock (&backend->priv->views_mutex);
}
/**
g_return_if_fail (backend != NULL);
g_return_if_fail (E_IS_CAL_BACKEND (backend));
- g_mutex_lock (backend->priv->views_mutex);
+ g_mutex_lock (&backend->priv->views_mutex);
backend->priv->views = g_list_remove (backend->priv->views, view);
- g_mutex_unlock (backend->priv->views_mutex);
+ g_mutex_unlock (&backend->priv->views_mutex);
}
/**
g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
- g_mutex_lock (backend->priv->views_mutex);
+ g_mutex_lock (&backend->priv->views_mutex);
/* XXX Use g_list_copy_deep() once we require GLib >= 2.34. */
list = g_list_copy (backend->priv->views);
g_list_foreach (list, (GFunc) g_object_ref, NULL);
- g_mutex_unlock (backend->priv->views_mutex);
+ g_mutex_unlock (&backend->priv->views_mutex);
return list;
}
g_return_if_fail (E_IS_CAL_BACKEND (backend));
g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->open != NULL);
- g_mutex_lock (backend->priv->clients_mutex);
+ g_mutex_lock (&backend->priv->clients_mutex);
if (e_cal_backend_is_opened (backend)) {
gboolean online;
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
e_data_cal_report_readonly (cal, backend->priv->readonly);
e_cal_backend_respond_opened (backend, cal, opid, NULL);
} else if (e_cal_backend_is_opening (backend)) {
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
e_data_cal_respond_open (cal, opid, EDC_OPENING_ERROR);
} else {
backend->priv->opening = TRUE;
- g_mutex_unlock (backend->priv->clients_mutex);
+ g_mutex_unlock (&backend->priv->clients_mutex);
(* E_CAL_BACKEND_GET_CLASS (backend)->open) (backend, cal, opid, cancellable, only_if_exists);
}
return;
}
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (l = priv->clients; l; l = l->next)
e_data_cal_report_error (l->data, message);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
return;
}
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (l = priv->clients; l; l = l->next)
e_data_cal_report_readonly (l->data, is_readonly);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
return;
}
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_cal_report_online (E_DATA_CAL (clients->data), is_online);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
GList *clients;
priv = backend->priv;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
priv->opening = FALSE;
priv->opened = error == NULL;
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_cal_report_opened (E_DATA_CAL (clients->data), error);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
if (error)
g_error_free (error);
g_return_if_fail (prop_value != NULL);
priv = backend->priv;
- g_mutex_lock (priv->clients_mutex);
+ g_mutex_lock (&priv->clients_mutex);
for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
e_data_cal_report_backend_property_changed (E_DATA_CAL (clients->data), prop_name, prop_value);
- g_mutex_unlock (priv->clients_mutex);
+ g_mutex_unlock (&priv->clients_mutex);
}
/**
ESourceRegistry *registry;
EGdbusCalFactory *gdbus_object;
- GMutex *calendars_lock;
+ GMutex calendars_lock;
/* A hash of object paths for calendar URIs to EDataCals */
GHashTable *calendars;
- GMutex *connections_lock;
+ GMutex connections_lock;
/* This is a hash of client addresses to GList* of EDataCals */
GHashTable *connections;
};
d (g_debug ("in factory %p (%p) is dead", factory, dead));
- g_mutex_lock (priv->calendars_lock);
- g_mutex_lock (priv->connections_lock);
+ g_mutex_lock (&priv->calendars_lock);
+ g_mutex_lock (&priv->connections_lock);
g_hash_table_foreach_remove (
priv->calendars, remove_dead_calendar_cb, dead);
}
}
- g_mutex_unlock (priv->connections_lock);
- g_mutex_unlock (priv->calendars_lock);
+ g_mutex_unlock (&priv->connections_lock);
+ g_mutex_unlock (&priv->calendars_lock);
e_dbus_server_release (E_DBUS_SERVER (factory));
}
connection, object_path, &error);
if (calendar != NULL) {
- g_mutex_lock (priv->calendars_lock);
+ g_mutex_lock (&priv->calendars_lock);
g_hash_table_insert (
priv->calendars, g_strdup (object_path), calendar);
- g_mutex_unlock (priv->calendars_lock);
+ g_mutex_unlock (&priv->calendars_lock);
e_cal_backend_add_client (E_CAL_BACKEND (backend), calendar);
calendar_freed_cb, factory);
/* Update the hash of open connections. */
- g_mutex_lock (priv->connections_lock);
+ g_mutex_lock (&priv->connections_lock);
list = g_hash_table_lookup (priv->connections, sender);
list = g_list_prepend (list, calendar);
g_hash_table_insert (
priv->connections, g_strdup (sender), list);
- g_mutex_unlock (priv->connections_lock);
+ g_mutex_unlock (&priv->connections_lock);
}
g_object_unref (backend);
g_hash_table_destroy (priv->calendars);
g_hash_table_destroy (priv->connections);
- g_mutex_free (priv->calendars_lock);
- g_mutex_free (priv->connections_lock);
+ g_mutex_clear (&priv->calendars_lock);
+ g_mutex_clear (&priv->connections_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_data_cal_factory_parent_class)->finalize (object);
priv = E_DATA_CAL_FACTORY_GET_PRIVATE (server);
- g_mutex_lock (priv->connections_lock);
+ g_mutex_lock (&priv->connections_lock);
while (g_hash_table_lookup_extended (
priv->connections,
g_list_free (copy);
}
- g_mutex_unlock (priv->connections_lock);
+ g_mutex_unlock (&priv->connections_lock);
/* Chain up to parent's bus_name_lost() method. */
E_DBUS_SERVER_CLASS (e_data_cal_factory_parent_class)->
factory->priv->gdbus_object, "handle-get-cal",
G_CALLBACK (impl_CalFactory_get_cal), factory);
- factory->priv->calendars_lock = g_mutex_new ();
+ g_mutex_init (&factory->priv->calendars_lock);
factory->priv->calendars = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) NULL);
- factory->priv->connections_lock = g_mutex_new ();
+ g_mutex_init (&factory->priv->connections_lock);
factory->priv->connections = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
GHashTable *ids;
- GMutex *pending_mutex;
+ GMutex pending_mutex;
guint flush_id;
/* view flags */
priv->sexp = NULL;
}
- g_mutex_lock (priv->pending_mutex);
+ g_mutex_lock (&priv->pending_mutex);
if (priv->flush_id > 0) {
g_source_remove (priv->flush_id);
priv->flush_id = 0;
}
- g_mutex_unlock (priv->pending_mutex);
+ g_mutex_unlock (&priv->pending_mutex);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_data_cal_view_parent_class)->dispose (object);
if (priv->fields_of_interest != NULL)
g_hash_table_destroy (priv->fields_of_interest);
- g_mutex_free (priv->pending_mutex);
+ g_mutex_clear (&priv->pending_mutex);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_data_cal_view_parent_class)->finalize (object);
(GDestroyNotify) e_cal_component_free_id,
(GDestroyNotify) NULL);
- view->priv->pending_mutex = g_mutex_new ();
+ g_mutex_init (&view->priv->pending_mutex);
view->priv->flush_id = 0;
}
{
EDataCalView *view = data;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
view->priv->flush_id = 0;
send_pending_changes (view);
send_pending_removes (view);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
return FALSE;
}
if (ecalcomponents == NULL)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
for (l = ecalcomponents; l; l = l->next) {
ECalComponent *comp = l->data;
notify_add_component (view, comp);
}
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (ecalcomponents == NULL)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
for (l = ecalcomponents; l; l = l->next) {
ECalComponent *comp = l->data;
notify_change_component (view, comp);
}
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (objects == NULL)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
for (l = objects; l; l = l->next) {
notify_add (view, e_util_utf8_make_valid (l->data));
}
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (objects == NULL)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
for (l = objects; l; l = l->next) {
/* TODO: send add/remove/change as relevant, based on ->ids */
notify_change (view, e_util_utf8_make_valid (l->data));
}
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (ids == NULL)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
for (l = ids; l; l = l->next) {
ECalComponentId *id = l->data;
notify_remove (view, id);
}
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
/**
if (!view->priv->started || view->priv->stopped)
return;
- g_mutex_lock (view->priv->pending_mutex);
+ g_mutex_lock (&view->priv->pending_mutex);
view->priv->complete = TRUE;
g_strfreev (error_strv);
- g_mutex_unlock (view->priv->pending_mutex);
+ g_mutex_unlock (&view->priv->pending_mutex);
}
ECalBackend *backend;
gchar *object_path;
- GStaticRecMutex pending_ops_lock;
+ GRecMutex pending_ops_lock;
GHashTable *pending_ops; /* opid to GCancellable for still running operations */
};
g_free (op->d.tzobject);
break;
case OP_CANCEL_OPERATION:
- g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
+ g_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
if (g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
GCancellable *cancellable = g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
g_cancellable_cancel (cancellable);
}
- g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
break;
case OP_CLOSE:
/* close just cancels all pending ops and frees data cal */
e_cal_backend_remove_client (backend, op->cal);
case OP_CANCEL_ALL:
- g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
+ g_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
g_hash_table_foreach (op->cal->priv->pending_ops, cancel_ops_cb, NULL);
- g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
break;
}
data->id = e_operation_pool_reserve_opid (ops_pool);
data->cancellable = g_cancellable_new ();
- g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
+ g_rec_mutex_lock (&cal->priv->pending_ops_lock);
g_hash_table_insert (cal->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
- g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&cal->priv->pending_ops_lock);
return data;
}
e_operation_pool_release_opid (ops_pool, opid);
- g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
+ g_rec_mutex_lock (&cal->priv->pending_ops_lock);
g_hash_table_remove (cal->priv->pending_ops, GUINT_TO_POINTER (opid));
- g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
+ g_rec_mutex_unlock (&cal->priv->pending_ops_lock);
}
/* Create the EDataCal error quark */
priv->pending_ops = NULL;
}
- g_static_rec_mutex_free (&priv->pending_ops_lock);
+ g_rec_mutex_clear (&priv->pending_ops_lock);
if (priv->dbus_interface) {
g_object_unref (priv->dbus_interface);
ecal->priv->dbus_interface = e_gdbus_cal_stub_new ();
ecal->priv->pending_ops = g_hash_table_new_full (
g_direct_hash, g_direct_equal, NULL, g_object_unref);
- g_static_rec_mutex_init (&ecal->priv->pending_ops_lock);
+ g_rec_mutex_init (&ecal->priv->pending_ops_lock);
dbus_interface = ecal->priv->dbus_interface;
g_signal_connect (
struct _CamelBlockFilePrivate {
struct _CamelBlockFile *base;
- GStaticMutex root_lock; /* for modifying the root block */
- GStaticMutex cache_lock; /* for refcounting, flag manip, cache manip */
- GStaticMutex io_lock; /* for all io ops */
+ GMutex root_lock; /* for modifying the root block */
+ GMutex cache_lock; /* for refcounting, flag manip, cache manip */
+ GMutex io_lock; /* for all io ops */
guint deleted : 1;
};
-#define CAMEL_BLOCK_FILE_LOCK(kf, lock) (g_static_mutex_lock(&(kf)->priv->lock))
-#define CAMEL_BLOCK_FILE_TRYLOCK(kf, lock) (g_static_mutex_trylock(&(kf)->priv->lock))
-#define CAMEL_BLOCK_FILE_UNLOCK(kf, lock) (g_static_mutex_unlock(&(kf)->priv->lock))
+#define CAMEL_BLOCK_FILE_LOCK(kf, lock) (g_mutex_lock(&(kf)->priv->lock))
+#define CAMEL_BLOCK_FILE_TRYLOCK(kf, lock) (g_mutex_trylock(&(kf)->priv->lock))
+#define CAMEL_BLOCK_FILE_UNLOCK(kf, lock) (g_mutex_unlock(&(kf)->priv->lock))
-#define LOCK(x) g_static_mutex_lock(&x)
-#define UNLOCK(x) g_static_mutex_unlock(&x)
+#define LOCK(x) g_mutex_lock(&x)
+#define UNLOCK(x) g_mutex_unlock(&x)
-static GStaticMutex block_file_lock = G_STATIC_MUTEX_INIT;
+static GMutex block_file_lock;
/* lru cache of block files */
static GQueue block_file_list = G_QUEUE_INIT;
if (bs->fd != -1)
close (bs->fd);
- g_static_mutex_free (&bs->priv->io_lock);
- g_static_mutex_free (&bs->priv->cache_lock);
- g_static_mutex_free (&bs->priv->root_lock);
+ g_mutex_clear (&bs->priv->io_lock);
+ g_mutex_clear (&bs->priv->cache_lock);
+ g_mutex_clear (&bs->priv->root_lock);
g_free (bs->priv);
bs->priv = g_malloc0 (sizeof (*bs->priv));
bs->priv->base = bs;
- g_static_mutex_init (&bs->priv->root_lock);
- g_static_mutex_init (&bs->priv->cache_lock);
- g_static_mutex_init (&bs->priv->io_lock);
+ g_mutex_init (&bs->priv->root_lock);
+ g_mutex_init (&bs->priv->cache_lock);
+ g_mutex_init (&bs->priv->io_lock);
/* link into lru list */
LOCK (block_file_lock);
struct _CamelKeyFilePrivate {
struct _CamelKeyFile *base;
- GStaticMutex lock;
+ GMutex lock;
guint deleted : 1;
};
-#define CAMEL_KEY_FILE_LOCK(kf, lock) (g_static_mutex_lock(&(kf)->priv->lock))
-#define CAMEL_KEY_FILE_TRYLOCK(kf, lock) (g_static_mutex_trylock(&(kf)->priv->lock))
-#define CAMEL_KEY_FILE_UNLOCK(kf, lock) (g_static_mutex_unlock(&(kf)->priv->lock))
+#define CAMEL_KEY_FILE_LOCK(kf, lock) (g_mutex_lock(&(kf)->priv->lock))
+#define CAMEL_KEY_FILE_TRYLOCK(kf, lock) (g_mutex_trylock(&(kf)->priv->lock))
+#define CAMEL_KEY_FILE_UNLOCK(kf, lock) (g_mutex_unlock(&(kf)->priv->lock))
-static GStaticMutex key_file_lock = G_STATIC_MUTEX_INIT;
+static GMutex key_file_lock;
/* lru cache of block files */
static GQueue key_file_list = G_QUEUE_INIT;
g_free (bs->path);
- g_static_mutex_free (&bs->priv->lock);
+ g_mutex_clear (&bs->priv->lock);
g_free (bs->priv);
bs->priv = g_malloc0 (sizeof (*bs->priv));
bs->priv->base = bs;
- g_static_mutex_init (&bs->priv->lock);
+ g_mutex_init (&bs->priv->lock);
LOCK (key_file_lock);
g_queue_push_head (&key_file_list, bs->priv);
((obj), CAMEL_TYPE_CERTDB, CamelCertDBPrivate))
struct _CamelCertDBPrivate {
- GMutex *db_lock; /* for the db hashtable/array */
- GMutex *io_lock; /* load/save lock, for access to saved_count, etc */
- GMutex *alloc_lock; /* for setting up and using allocators */
- GMutex *ref_lock; /* for reffing/unreffing certs */
+ GMutex db_lock; /* for the db hashtable/array */
+ GMutex io_lock; /* load/save lock, for access to saved_count, etc */
+ GMutex alloc_lock; /* for setting up and using allocators */
+ GMutex ref_lock; /* for reffing/unreffing certs */
};
static gint certdb_header_load (CamelCertDB *certdb, FILE *istream);
if (certdb->cert_chunks)
camel_memchunk_destroy (certdb->cert_chunks);
- g_mutex_free (priv->db_lock);
- g_mutex_free (priv->io_lock);
- g_mutex_free (priv->alloc_lock);
- g_mutex_free (priv->ref_lock);
+ g_mutex_clear (&priv->db_lock);
+ g_mutex_clear (&priv->io_lock);
+ g_mutex_clear (&priv->alloc_lock);
+ g_mutex_clear (&priv->ref_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_certdb_parent_class)->finalize (object);
certdb->certs = g_ptr_array_new ();
certdb->cert_hash = g_hash_table_new_full (certdb_key_hash, certdb_key_equal, certdb_key_free, NULL);
- certdb->priv->db_lock = g_mutex_new ();
- certdb->priv->io_lock = g_mutex_new ();
- certdb->priv->alloc_lock = g_mutex_new ();
- certdb->priv->ref_lock = g_mutex_new ();
+ g_mutex_init (&certdb->priv->db_lock);
+ g_mutex_init (&certdb->priv->io_lock);
+ g_mutex_init (&certdb->priv->alloc_lock);
+ g_mutex_init (&certdb->priv->ref_lock);
}
CamelCertDB *
}
static CamelCertDB *default_certdb = NULL;
-static GStaticMutex default_certdb_lock = G_STATIC_MUTEX_INIT;
+static GMutex default_certdb_lock;
void
camel_certdb_set_default (CamelCertDB *certdb)
{
- g_static_mutex_lock (&default_certdb_lock);
+ g_mutex_lock (&default_certdb_lock);
if (default_certdb)
g_object_unref (default_certdb);
default_certdb = certdb;
- g_static_mutex_unlock (&default_certdb_lock);
+ g_mutex_unlock (&default_certdb_lock);
}
CamelCertDB *
{
CamelCertDB *certdb;
- g_static_mutex_lock (&default_certdb_lock);
+ g_mutex_lock (&default_certdb_lock);
if (default_certdb)
g_object_ref (default_certdb);
certdb = default_certdb;
- g_static_mutex_unlock (&default_certdb_lock);
+ g_mutex_unlock (&default_certdb_lock);
return certdb;
}
switch (lock) {
case CAMEL_CERTDB_DB_LOCK:
- g_mutex_lock (certdb->priv->db_lock);
+ g_mutex_lock (&certdb->priv->db_lock);
break;
case CAMEL_CERTDB_IO_LOCK:
- g_mutex_lock (certdb->priv->io_lock);
+ g_mutex_lock (&certdb->priv->io_lock);
break;
case CAMEL_CERTDB_ALLOC_LOCK:
- g_mutex_lock (certdb->priv->alloc_lock);
+ g_mutex_lock (&certdb->priv->alloc_lock);
break;
case CAMEL_CERTDB_REF_LOCK:
- g_mutex_lock (certdb->priv->ref_lock);
+ g_mutex_lock (&certdb->priv->ref_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_CERTDB_DB_LOCK:
- g_mutex_unlock (certdb->priv->db_lock);
+ g_mutex_unlock (&certdb->priv->db_lock);
break;
case CAMEL_CERTDB_IO_LOCK:
- g_mutex_unlock (certdb->priv->io_lock);
+ g_mutex_unlock (&certdb->priv->io_lock);
break;
case CAMEL_CERTDB_ALLOC_LOCK:
- g_mutex_unlock (certdb->priv->alloc_lock);
+ g_mutex_unlock (&certdb->priv->alloc_lock);
break;
case CAMEL_CERTDB_REF_LOCK:
- g_mutex_unlock (certdb->priv->ref_lock);
+ g_mutex_unlock (&certdb->priv->ref_lock);
break;
default:
g_return_if_reached ();
((obj), CAMEL_TYPE_CIPHER_CONTEXT, CamelCipherContextPrivate))
#define CIPHER_LOCK(ctx) \
- g_mutex_lock (((CamelCipherContext *) ctx)->priv->lock)
+ g_mutex_lock (&((CamelCipherContext *) ctx)->priv->lock)
#define CIPHER_UNLOCK(ctx) \
- g_mutex_unlock (((CamelCipherContext *) ctx)->priv->lock);
+ g_mutex_unlock (&((CamelCipherContext *) ctx)->priv->lock);
#define d(x)
struct _CamelCipherContextPrivate {
CamelSession *session;
- GMutex *lock;
+ GMutex lock;
};
struct _AsyncContext {
priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (object);
- g_mutex_free (priv->lock);
+ g_mutex_clear (&priv->lock);
/* Chain up to parent's finalize () method. */
G_OBJECT_CLASS (camel_cipher_context_parent_class)->finalize (object);
camel_cipher_context_init (CamelCipherContext *context)
{
context->priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (context);
- context->priv->lock = g_mutex_new ();
+ g_mutex_init (&context->priv->lock);
}
/**
typedef struct _AsyncContext AsyncContext;
struct _CamelDataWrapperPrivate {
- GStaticMutex stream_lock;
+ GMutex stream_lock;
GByteArray *byte_array;
};
priv = CAMEL_DATA_WRAPPER_GET_PRIVATE (object);
- g_static_mutex_free (&priv->stream_lock);
+ g_mutex_clear (&priv->stream_lock);
g_byte_array_free (priv->byte_array, TRUE);
/* Chain up to parent's finalize() method. */
{
data_wrapper->priv = CAMEL_DATA_WRAPPER_GET_PRIVATE (data_wrapper);
- g_static_mutex_init (&data_wrapper->priv->stream_lock);
+ g_mutex_init (&data_wrapper->priv->stream_lock);
data_wrapper->priv->byte_array = g_byte_array_new ();
data_wrapper->mime_type = camel_content_type_new (
switch (lock) {
case CAMEL_DATA_WRAPPER_STREAM_LOCK:
- g_static_mutex_lock (&data_wrapper->priv->stream_lock);
+ g_mutex_lock (&data_wrapper->priv->stream_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_DATA_WRAPPER_STREAM_LOCK:
- g_static_mutex_unlock (&data_wrapper->priv->stream_lock);
+ g_mutex_unlock (&data_wrapper->priv->stream_lock);
break;
default:
g_return_if_reached ();
/* how long to wait before invoking sync on the file */
#define SYNC_TIMEOUT_SECONDS 5
-#define READER_LOCK(cdb) g_static_rw_lock_reader_lock (&cdb->priv->rwlock)
-#define READER_UNLOCK(cdb) g_static_rw_lock_reader_unlock (&cdb->priv->rwlock)
-#define WRITER_LOCK(cdb) g_static_rw_lock_writer_lock (&cdb->priv->rwlock)
-#define WRITER_UNLOCK(cdb) g_static_rw_lock_writer_unlock (&cdb->priv->rwlock)
+#define READER_LOCK(cdb) g_rw_lock_reader_lock (&cdb->priv->rwlock)
+#define READER_UNLOCK(cdb) g_rw_lock_reader_unlock (&cdb->priv->rwlock)
+#define WRITER_LOCK(cdb) g_rw_lock_writer_lock (&cdb->priv->rwlock)
+#define WRITER_UNLOCK(cdb) g_rw_lock_writer_unlock (&cdb->priv->rwlock)
static sqlite3_vfs *old_vfs = NULL;
static GThreadPool *sync_pool = NULL;
typedef struct {
sqlite3_file parent;
sqlite3_file *old_vfs_file; /* pointer to old_vfs' file */
- GStaticRecMutex sync_mutex;
+ GRecMutex sync_mutex;
guint timeout_id;
gint flags;
} CamelSqlite3File;
}
typedef struct {
- GCond *cond;
- GMutex *mutex;
+ GCond cond;
+ GMutex mutex;
gboolean is_set;
} SyncDone;
g_free (sync_data);
if (done != NULL) {
- g_mutex_lock (done->mutex);
+ g_mutex_lock (&done->mutex);
done->is_set = TRUE;
- g_cond_broadcast (done->cond);
- g_mutex_unlock (done->mutex);
+ g_cond_broadcast (&done->cond);
+ g_mutex_unlock (&done->mutex);
}
}
g_return_if_fail (cFile != NULL);
g_return_if_fail (sync_pool != NULL);
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
if (wait_for_finish) {
done = g_slice_new (SyncDone);
- done->cond = g_cond_new ();
- done->mutex = g_mutex_new ();
+ g_cond_init (&done->cond);
+ g_mutex_init (&done->mutex);
done->is_set = FALSE;
}
cFile->flags = 0;
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
g_thread_pool_push (sync_pool, data, &error);
g_error_free (error);
if (done != NULL) {
- g_cond_free (done->cond);
- g_mutex_free (done->mutex);
+ g_cond_clear (&done->cond);
+ g_mutex_clear (&done->mutex);
g_slice_free (SyncDone, done);
}
}
if (done != NULL) {
- g_mutex_lock (done->mutex);
+ g_mutex_lock (&done->mutex);
while (!done->is_set)
- g_cond_wait (done->cond, done->mutex);
- g_mutex_unlock (done->mutex);
+ g_cond_wait (&done->cond, &done->mutex);
+ g_mutex_unlock (&done->mutex);
- g_cond_free (done->cond);
- g_mutex_free (done->mutex);
+ g_cond_clear (&done->cond);
+ g_mutex_clear (&done->mutex);
g_slice_free (SyncDone, done);
}
}
static gboolean
sync_push_request_timeout (CamelSqlite3File *cFile)
{
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
if (cFile->timeout_id != 0) {
sync_push_request (cFile, FALSE);
cFile->timeout_id = 0;
}
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
return FALSE;
}
cFile = (CamelSqlite3File *) pFile;
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
/* Cancel any pending sync requests. */
if (cFile->timeout_id > 0) {
cFile->timeout_id = 0;
}
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
/* Make the last sync. */
sync_push_request (cFile, TRUE);
g_free (cFile->old_vfs_file);
cFile->old_vfs_file = NULL;
- g_static_rec_mutex_free (&cFile->sync_mutex);
+ g_rec_mutex_clear (&cFile->sync_mutex);
return res;
}
cFile = (CamelSqlite3File *) pFile;
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
/* If a sync request is already scheduled, accumulate flags. */
cFile->flags |= flags;
SYNC_TIMEOUT_SECONDS, (GSourceFunc)
sync_push_request_timeout, cFile);
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
return SQLITE_OK;
}
gint flags,
gint *pOutFlags)
{
- static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT;
+ static GRecMutex only_once_lock;
static sqlite3_io_methods io_methods = {0};
CamelSqlite3File *cFile;
gint res;
return res;
}
- g_static_rec_mutex_init (&cFile->sync_mutex);
+ g_rec_mutex_init (&cFile->sync_mutex);
- g_static_rec_mutex_lock (&only_once_lock);
+ g_rec_mutex_lock (&only_once_lock);
if (!sync_pool)
sync_pool = g_thread_pool_new (sync_request_thread_cb, NULL, 2, FALSE, NULL);
#undef use_subclassed
}
- g_static_rec_mutex_unlock (&only_once_lock);
+ g_rec_mutex_unlock (&only_once_lock);
cFile->parent.pMethods = &io_methods;
struct _CamelDBPrivate {
GTimer *timer;
- GStaticRWLock rwlock;
+ GRWLock rwlock;
gchar *file_name;
gboolean transaction_is_on;
};
cdb->db = db;
cdb->priv = g_new (CamelDBPrivate, 1);
cdb->priv->file_name = g_strdup (path);
- g_static_rw_lock_init (&cdb->priv->rwlock);
+ g_rw_lock_init (&cdb->priv->rwlock);
cdb->priv->timer = NULL;
d (g_print ("\nDatabase succesfully opened \n"));
{
if (cdb) {
sqlite3_close (cdb->db);
- g_static_rw_lock_free (&cdb->priv->rwlock);
+ g_rw_lock_clear (&cdb->priv->rwlock);
g_free (cdb->priv->file_name);
g_free (cdb->priv);
g_free (cdb);
return FALSE;
}
-static GStaticMutex debug_lock = G_STATIC_MUTEX_INIT;
+static GMutex debug_lock;
/**
* camel_debug_start:
* @mode:
camel_debug_start (const gchar *mode)
{
if (camel_debug (mode)) {
- g_static_mutex_lock (&debug_lock);
+ g_mutex_lock (&debug_lock);
printf ("Thread %p >\n", g_thread_self ());
return TRUE;
}
camel_debug_end (void)
{
printf ("< %p >\n", g_thread_self ());
- g_static_mutex_unlock (&debug_lock);
+ g_mutex_unlock (&debug_lock);
}
#if 0
static gchar *debuginfo_path = NULL;
static Dwfl *dwfl = NULL;
static gboolean checked_for_dwfl = FALSE;
- static GStaticMutex dwfl_mutex = G_STATIC_MUTEX_INIT;
+ static GMutex dwfl_mutex;
static const Dwfl_Callbacks proc_callbacks = {
.find_debuginfo = dwfl_standard_find_debuginfo,
.debuginfo_path = &debuginfo_path,
.find_elf = dwfl_linux_proc_find_elf
};
- g_static_mutex_lock (&dwfl_mutex);
+ g_mutex_lock (&dwfl_mutex);
if (checked_for_dwfl) {
if (!reload) {
- g_static_mutex_unlock (&dwfl_mutex);
+ g_mutex_unlock (&dwfl_mutex);
return dwfl;
}
dwfl = dwfl_begin (&proc_callbacks);
if (!dwfl) {
- g_static_mutex_unlock (&dwfl_mutex);
+ g_mutex_unlock (&dwfl_mutex);
return NULL;
}
dwfl = NULL;
}
- g_static_mutex_unlock (&dwfl_mutex);
+ g_mutex_unlock (&dwfl_mutex);
return dwfl;
}
G_LOCK (ptr_tracker);
if (!ptr_tracker) {
ptr_tracker = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, free_pt_data);
- g_atexit (dump_left_at_exit_cb);
+ atexit (dump_left_at_exit_cb);
}
ptd = g_new0 (struct pt_data, 1);
struct _CamelIndex *index;
- GStaticRecMutex summary_lock; /* for the summary hashtable/array */
- GStaticRecMutex io_lock; /* load/save lock, for access to saved_count, etc */
- GStaticRecMutex filter_lock; /* for accessing any of the filtering/indexing stuff, since we share them */
- GStaticRecMutex alloc_lock; /* for setting up and using allocators */
- GStaticRecMutex ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
+ GRecMutex summary_lock; /* for the summary hashtable/array */
+ GRecMutex io_lock; /* load/save lock, for access to saved_count, etc */
+ GRecMutex filter_lock; /* for accessing any of the filtering/indexing stuff, since we share them */
+ GRecMutex alloc_lock; /* for setting up and using allocators */
+ GRecMutex ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
gboolean need_preview;
GHashTable *preview_updates;
guint timeout_handle;
};
-static GStaticMutex info_lock = G_STATIC_MUTEX_INIT;
+static GMutex info_lock;
/* this lock is ONLY for the standalone messageinfo stuff */
-#define GLOBAL_INFO_LOCK(i) g_static_mutex_lock(&info_lock)
-#define GLOBAL_INFO_UNLOCK(i) g_static_mutex_unlock(&info_lock)
+#define GLOBAL_INFO_LOCK(i) g_mutex_lock(&info_lock)
+#define GLOBAL_INFO_UNLOCK(i) g_mutex_unlock(&info_lock)
/* this should probably be conditional on it existing */
#define USE_BSEARCH
g_hash_table_destroy (priv->preview_updates);
- g_static_rec_mutex_free (&priv->summary_lock);
- g_static_rec_mutex_free (&priv->io_lock);
- g_static_rec_mutex_free (&priv->filter_lock);
- g_static_rec_mutex_free (&priv->alloc_lock);
- g_static_rec_mutex_free (&priv->ref_lock);
+ g_rec_mutex_clear (&priv->summary_lock);
+ g_rec_mutex_clear (&priv->io_lock);
+ g_rec_mutex_clear (&priv->filter_lock);
+ g_rec_mutex_clear (&priv->alloc_lock);
+ g_rec_mutex_clear (&priv->ref_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_folder_summary_parent_class)->finalize (object);
summary->priv->uids = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) camel_pstring_free, NULL);
summary->priv->loaded_infos = g_hash_table_new (g_str_hash, g_str_equal);
- g_static_rec_mutex_init (&summary->priv->summary_lock);
- g_static_rec_mutex_init (&summary->priv->io_lock);
- g_static_rec_mutex_init (&summary->priv->filter_lock);
- g_static_rec_mutex_init (&summary->priv->alloc_lock);
- g_static_rec_mutex_init (&summary->priv->ref_lock);
+ g_rec_mutex_init (&summary->priv->summary_lock);
+ g_rec_mutex_init (&summary->priv->io_lock);
+ g_rec_mutex_init (&summary->priv->filter_lock);
+ g_rec_mutex_init (&summary->priv->alloc_lock);
+ g_rec_mutex_init (&summary->priv->ref_lock);
summary->priv->cache_load_time = 0;
summary->priv->timeout_handle = 0;
switch (lock) {
case CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK:
- g_static_rec_mutex_lock (&summary->priv->summary_lock);
+ g_rec_mutex_lock (&summary->priv->summary_lock);
break;
case CAMEL_FOLDER_SUMMARY_IO_LOCK:
- g_static_rec_mutex_lock (&summary->priv->io_lock);
+ g_rec_mutex_lock (&summary->priv->io_lock);
break;
case CAMEL_FOLDER_SUMMARY_FILTER_LOCK:
- g_static_rec_mutex_lock (&summary->priv->filter_lock);
+ g_rec_mutex_lock (&summary->priv->filter_lock);
break;
case CAMEL_FOLDER_SUMMARY_ALLOC_LOCK:
- g_static_rec_mutex_lock (&summary->priv->alloc_lock);
+ g_rec_mutex_lock (&summary->priv->alloc_lock);
break;
case CAMEL_FOLDER_SUMMARY_REF_LOCK:
- g_static_rec_mutex_lock (&summary->priv->ref_lock);
+ g_rec_mutex_lock (&summary->priv->ref_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->summary_lock);
+ g_rec_mutex_unlock (&summary->priv->summary_lock);
break;
case CAMEL_FOLDER_SUMMARY_IO_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->io_lock);
+ g_rec_mutex_unlock (&summary->priv->io_lock);
break;
case CAMEL_FOLDER_SUMMARY_FILTER_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->filter_lock);
+ g_rec_mutex_unlock (&summary->priv->filter_lock);
break;
case CAMEL_FOLDER_SUMMARY_ALLOC_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->alloc_lock);
+ g_rec_mutex_unlock (&summary->priv->alloc_lock);
break;
case CAMEL_FOLDER_SUMMARY_REF_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->ref_lock);
+ g_rec_mutex_unlock (&summary->priv->ref_lock);
break;
default:
g_return_if_reached ();
typedef struct _FolderFilterData FolderFilterData;
struct _CamelFolderPrivate {
- GStaticRecMutex lock;
- GStaticMutex change_lock;
+ GRecMutex lock;
+ GMutex change_lock;
/* must require the 'change_lock' to access this */
gint frozen;
CamelFolderChangeInfo *changed_frozen; /* queues changed events */
if (priv->pending_changes != NULL)
camel_folder_change_info_free (priv->pending_changes);
- g_static_rec_mutex_free (&priv->lock);
- g_static_mutex_free (&priv->change_lock);
+ g_rec_mutex_clear (&priv->lock);
+ g_mutex_clear (&priv->change_lock);
/* Chain up to parent's finalize () method. */
G_OBJECT_CLASS (camel_folder_parent_class)->finalize (object);
folder->priv->frozen = 0;
folder->priv->changed_frozen = camel_folder_change_info_new ();
- g_static_rec_mutex_init (&folder->priv->lock);
- g_static_mutex_init (&folder->priv->change_lock);
+ g_rec_mutex_init (&folder->priv->lock);
+ g_mutex_init (&folder->priv->change_lock);
}
GQuark
switch (lock) {
case CAMEL_FOLDER_CHANGE_LOCK:
- g_static_mutex_lock (&folder->priv->change_lock);
+ g_mutex_lock (&folder->priv->change_lock);
break;
case CAMEL_FOLDER_REC_LOCK:
if (folder->priv->skip_folder_lock == FALSE)
- g_static_rec_mutex_lock (&folder->priv->lock);
+ g_rec_mutex_lock (&folder->priv->lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_FOLDER_CHANGE_LOCK:
- g_static_mutex_unlock (&folder->priv->change_lock);
+ g_mutex_unlock (&folder->priv->change_lock);
break;
case CAMEL_FOLDER_REC_LOCK:
if (folder->priv->skip_folder_lock == FALSE)
- g_static_rec_mutex_unlock (&folder->priv->lock);
+ g_rec_mutex_unlock (&folder->priv->lock);
break;
default:
g_return_if_reached ();
GString *buffer;
/* Used for running some commands synchronously. */
- GCond *done_sync_cond;
- GMutex *done_sync_mutex;
+ GCond done_sync_cond;
+ GMutex done_sync_mutex;
gboolean done_sync_flag;
};
/* Initialize private bits. */
real_ic->ref_count = 1;
real_ic->buffer = g_string_sized_new (512);
- real_ic->done_sync_cond = g_cond_new ();
- real_ic->done_sync_mutex = g_mutex_new ();
+ g_cond_init (&real_ic->done_sync_cond);
+ g_mutex_init (&real_ic->done_sync_mutex);
/* Initialize public bits. */
real_ic->public.is = is;
g_string_free (real_ic->buffer, TRUE);
- g_cond_free (real_ic->done_sync_cond);
- g_mutex_free (real_ic->done_sync_mutex);
+ g_cond_clear (&real_ic->done_sync_cond);
+ g_mutex_clear (&real_ic->done_sync_mutex);
/* Do NOT try to free the GError. If set it should have been
* propagated to the CamelIMAPXJob, so it's either NULL or the
real_ic = (CamelIMAPXRealCommand *) ic;
- g_mutex_lock (real_ic->done_sync_mutex);
+ g_mutex_lock (&real_ic->done_sync_mutex);
while (!real_ic->done_sync_flag)
g_cond_wait (
- real_ic->done_sync_cond,
- real_ic->done_sync_mutex);
- g_mutex_unlock (real_ic->done_sync_mutex);
+ &real_ic->done_sync_cond,
+ &real_ic->done_sync_mutex);
+ g_mutex_unlock (&real_ic->done_sync_mutex);
}
void
real_ic = (CamelIMAPXRealCommand *) ic;
- g_mutex_lock (real_ic->done_sync_mutex);
+ g_mutex_lock (&real_ic->done_sync_mutex);
real_ic->done_sync_flag = TRUE;
- g_cond_broadcast (real_ic->done_sync_cond);
- g_mutex_unlock (real_ic->done_sync_mutex);
+ g_cond_broadcast (&real_ic->done_sync_cond);
+ g_mutex_unlock (&real_ic->done_sync_mutex);
}
gboolean
#define c(...) camel_imapx_debug(conman, __VA_ARGS__)
#define CON_READ_LOCK(x) \
- (g_static_rw_lock_reader_lock (&(x)->priv->rw_lock))
+ (g_rw_lock_reader_lock (&(x)->priv->rw_lock))
#define CON_READ_UNLOCK(x) \
- (g_static_rw_lock_reader_unlock (&(x)->priv->rw_lock))
+ (g_rw_lock_reader_unlock (&(x)->priv->rw_lock))
#define CON_WRITE_LOCK(x) \
- (g_static_rw_lock_writer_lock (&(x)->priv->rw_lock))
+ (g_rw_lock_writer_lock (&(x)->priv->rw_lock))
#define CON_WRITE_UNLOCK(x) \
- (g_static_rw_lock_writer_unlock (&(x)->priv->rw_lock))
+ (g_rw_lock_writer_unlock (&(x)->priv->rw_lock))
#define CAMEL_IMAPX_CONN_MANAGER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
* with CamelIMAPXServer pointers as the keys. */
GList *connections;
gpointer store; /* weak pointer */
- GStaticRWLock rw_lock;
+ GRWLock rw_lock;
};
struct _ConnectionInfo {
- GMutex *lock;
+ GMutex lock;
CamelIMAPXServer *is;
GHashTable *folder_names;
gchar *selected_folder;
(GDestroyNotify) NULL);
cinfo = g_slice_new0 (ConnectionInfo);
- cinfo->lock = g_mutex_new ();
+ g_mutex_init (&cinfo->lock);
cinfo->is = g_object_ref (is);
cinfo->folder_names = folder_names;
cinfo->ref_count = 1;
if (g_atomic_int_dec_and_test (&cinfo->ref_count)) {
camel_imapx_server_connect (cinfo->is, NULL, NULL);
- g_mutex_free (cinfo->lock);
+ g_mutex_clear (&cinfo->lock);
g_object_unref (cinfo->is);
g_hash_table_destroy (cinfo->folder_names);
g_free (cinfo->selected_folder);
g_return_val_if_fail (cinfo != NULL, FALSE);
- g_mutex_lock (cinfo->lock);
+ g_mutex_lock (&cinfo->lock);
/* Available means it's not tracking any folder names. */
available = (g_hash_table_size (cinfo->folder_names) == 0);
- g_mutex_unlock (cinfo->lock);
+ g_mutex_unlock (&cinfo->lock);
return available;
}
if (folder_name == NULL)
return FALSE;
- g_mutex_lock (cinfo->lock);
+ g_mutex_lock (&cinfo->lock);
value = g_hash_table_lookup (cinfo->folder_names, folder_name);
- g_mutex_unlock (cinfo->lock);
+ g_mutex_unlock (&cinfo->lock);
return (value != NULL);
}
g_return_if_fail (cinfo != NULL);
g_return_if_fail (folder_name != NULL);
- g_mutex_lock (cinfo->lock);
+ g_mutex_lock (&cinfo->lock);
g_hash_table_insert (
cinfo->folder_names,
g_strdup (folder_name),
GINT_TO_POINTER (1));
- g_mutex_unlock (cinfo->lock);
+ g_mutex_unlock (&cinfo->lock);
}
static void
g_return_if_fail (cinfo != NULL);
g_return_if_fail (folder_name != NULL);
- g_mutex_lock (cinfo->lock);
+ g_mutex_lock (&cinfo->lock);
g_hash_table_remove (cinfo->folder_names, folder_name);
- g_mutex_unlock (cinfo->lock);
+ g_mutex_unlock (&cinfo->lock);
}
static gchar *
g_return_val_if_fail (cinfo != NULL, NULL);
- g_mutex_lock (cinfo->lock);
+ g_mutex_lock (&cinfo->lock);
selected_folder = g_strdup (cinfo->selected_folder);
- g_mutex_unlock (cinfo->lock);
+ g_mutex_unlock (&cinfo->lock);
return selected_folder;
}
{
g_return_if_fail (cinfo != NULL);
- g_mutex_lock (cinfo->lock);
+ g_mutex_lock (&cinfo->lock);
g_free (cinfo->selected_folder);
cinfo->selected_folder = g_strdup (selected_folder);
- g_mutex_unlock (cinfo->lock);
+ g_mutex_unlock (&cinfo->lock);
}
static GList *
priv = CAMEL_IMAPX_CONN_MANAGER_GET_PRIVATE (object);
- g_static_rw_lock_free (&priv->rw_lock);
+ g_rw_lock_clear (&priv->rw_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_imapx_conn_manager_parent_class)->finalize (object);
{
con_man->priv = CAMEL_IMAPX_CONN_MANAGER_GET_PRIVATE (con_man);
- g_static_rw_lock_init (&con_man->priv->rw_lock);
+ g_rw_lock_init (&con_man->priv->rw_lock);
}
/* Static functions go here */
camel_object_state_read (CAMEL_OBJECT (folder));
ifolder->search = camel_folder_search_new ();
- ifolder->search_lock = g_mutex_new ();
- ifolder->stream_lock = g_mutex_new ();
+ g_mutex_init (&ifolder->search_lock);
+ g_mutex_init (&ifolder->stream_lock);
ifolder->ignore_recent = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
ifolder->exists_on_server = 0;
ifolder->unread_on_server = 0;
if (folder->ignore_recent != NULL)
g_hash_table_unref (folder->ignore_recent);
- g_mutex_free (folder->search_lock);
- g_mutex_free (folder->stream_lock);
+ g_mutex_clear (&folder->search_lock);
+ g_mutex_clear (&folder->stream_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_imapx_folder_parent_class)->finalize (object);
g_return_if_fail (ifolder->search);
- g_mutex_lock (ifolder->search_lock);
+ g_mutex_lock (&ifolder->search_lock);
camel_folder_search_free_result (ifolder->search, uids);
- g_mutex_unlock (ifolder->search_lock);
+ g_mutex_unlock (&ifolder->search_lock);
}
static GPtrArray *
if (uids->len == 0)
return g_ptr_array_new ();
- g_mutex_lock (ifolder->search_lock);
+ g_mutex_lock (&ifolder->search_lock);
camel_folder_search_set_folder (ifolder->search, folder);
matches = camel_folder_search_search (ifolder->search, expression, uids, cancellable, error);
- g_mutex_unlock (ifolder->search_lock);
+ g_mutex_unlock (&ifolder->search_lock);
return matches;
}
CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
guint32 matches;
- g_mutex_lock (ifolder->search_lock);
+ g_mutex_lock (&ifolder->search_lock);
camel_folder_search_set_folder (ifolder->search, folder);
matches = camel_folder_search_count (ifolder->search, expression, cancellable, error);
- g_mutex_unlock (ifolder->search_lock);
+ g_mutex_unlock (&ifolder->search_lock);
return matches;
}
CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
GPtrArray *matches;
- g_mutex_lock (ifolder->search_lock);
+ g_mutex_lock (&ifolder->search_lock);
camel_folder_search_set_folder (ifolder->search, folder);
matches = camel_folder_search_search (ifolder->search, expression, NULL, cancellable, error);
- g_mutex_unlock (ifolder->search_lock);
+ g_mutex_unlock (&ifolder->search_lock);
return matches;
}
if (stream != NULL) {
msg = camel_mime_message_new ();
- g_mutex_lock (ifolder->stream_lock);
+ g_mutex_lock (&ifolder->stream_lock);
if (!camel_data_wrapper_construct_from_stream_sync (
(CamelDataWrapper *) msg, stream, cancellable, error)) {
g_object_unref (msg);
msg = NULL;
}
- g_mutex_unlock (ifolder->stream_lock);
+ g_mutex_unlock (&ifolder->stream_lock);
g_object_unref (stream);
if (msg) {
/* hash table of UIDs to ignore as recent when updating folder */
GHashTable *ignore_recent;
- GMutex *search_lock;
- GMutex *stream_lock;
+ GMutex search_lock;
+ GMutex stream_lock;
gboolean apply_filters; /* persistent property */
};
GCancellable *cancellable;
/* Used for running some jobs synchronously. */
- GCond *done_cond;
- GMutex *done_mutex;
+ GCond done_cond;
+ GMutex done_mutex;
gboolean done_flag;
/* Extra job-specific data. */
/* Initialize private bits. */
real_job->ref_count = 1;
- real_job->done_cond = g_cond_new ();
- real_job->done_mutex = g_mutex_new ();
+ g_cond_init (&real_job->done_cond);
+ g_mutex_init (&real_job->done_mutex);
if (cancellable != NULL)
g_object_ref (cancellable);
/* Free the private stuff. */
- g_cond_free (real_job->done_cond);
- g_mutex_free (real_job->done_mutex);
+ g_cond_clear (&real_job->done_cond);
+ g_mutex_clear (&real_job->done_mutex);
if (real_job->destroy_data != NULL)
real_job->destroy_data (real_job->data);
real_job = (CamelIMAPXRealJob *) job;
- g_mutex_lock (real_job->done_mutex);
+ g_mutex_lock (&real_job->done_mutex);
while (!real_job->done_flag)
g_cond_wait (
- real_job->done_cond,
- real_job->done_mutex);
- g_mutex_unlock (real_job->done_mutex);
+ &real_job->done_cond,
+ &real_job->done_mutex);
+ g_mutex_unlock (&real_job->done_mutex);
}
void
real_job = (CamelIMAPXRealJob *) job;
- g_mutex_lock (real_job->done_mutex);
+ g_mutex_lock (&real_job->done_mutex);
real_job->done_flag = TRUE;
- g_cond_broadcast (real_job->done_cond);
- g_mutex_unlock (real_job->done_mutex);
+ g_cond_broadcast (&real_job->done_cond);
+ g_mutex_unlock (&real_job->done_mutex);
}
gboolean
#define CIF(x) ((CamelIMAPXFolder *)x)
-#define QUEUE_LOCK(x) (g_static_rec_mutex_lock(&(x)->queue_lock))
-#define QUEUE_UNLOCK(x) (g_static_rec_mutex_unlock(&(x)->queue_lock))
+#define QUEUE_LOCK(x) (g_rec_mutex_lock(&(x)->queue_lock))
+#define QUEUE_UNLOCK(x) (g_rec_mutex_unlock(&(x)->queue_lock))
-#define IDLE_LOCK(x) (g_mutex_lock((x)->idle_lock))
-#define IDLE_UNLOCK(x) (g_mutex_unlock((x)->idle_lock))
+#define IDLE_LOCK(x) (g_mutex_lock(&(x)->idle_lock))
+#define IDLE_UNLOCK(x) (g_mutex_unlock(&(x)->idle_lock))
/* Try pipelining fetch requests, 'in bits' */
#define MULTI_SIZE (20480)
queued, before actually sending IDLE */
struct _CamelIMAPXIdle {
- GMutex *idle_lock;
+ GMutex idle_lock;
GThread *idle_thread;
- GCond *start_watch_cond;
- GMutex *start_watch_mutex;
+ GCond start_watch_cond;
+ GMutex start_watch_mutex;
gboolean start_watch_is_set;
time_t started;
while (TRUE) {
CamelIMAPXFolder *ifolder;
- g_mutex_lock (is->idle->start_watch_mutex);
+ g_mutex_lock (&is->idle->start_watch_mutex);
is->idle->start_watch_is_set = FALSE;
- g_mutex_unlock (is->idle->start_watch_mutex);
+ g_mutex_unlock (&is->idle->start_watch_mutex);
IDLE_LOCK (is->idle);
while ((ifolder = (CamelIMAPXFolder *) is->select_folder) &&
}
IDLE_UNLOCK (is->idle);
- g_mutex_lock (is->idle->start_watch_mutex);
+ g_mutex_lock (&is->idle->start_watch_mutex);
while (!is->idle->start_watch_is_set)
g_cond_wait (
- is->idle->start_watch_cond,
- is->idle->start_watch_mutex);
- g_mutex_unlock (is->idle->start_watch_mutex);
+ &is->idle->start_watch_cond,
+ &is->idle->start_watch_mutex);
+ g_mutex_unlock (&is->idle->start_watch_mutex);
if (is->idle->idle_exit)
break;
imapx_init_idle (CamelIMAPXServer *is)
{
is->idle = g_new0 (CamelIMAPXIdle, 1);
- is->idle->idle_lock = g_mutex_new ();
+ g_mutex_init (&is->idle->idle_lock);
}
static void
if (idle->idle_thread) {
idle->idle_exit = TRUE;
- g_mutex_lock (idle->start_watch_mutex);
+ g_mutex_lock (&idle->start_watch_mutex);
idle->start_watch_is_set = TRUE;
- g_cond_broadcast (idle->start_watch_cond);
- g_mutex_unlock (idle->start_watch_mutex);
+ g_cond_broadcast (&idle->start_watch_cond);
+ g_mutex_unlock (&idle->start_watch_mutex);
thread = idle->idle_thread;
- idle->idle_thread = 0;
+ idle->idle_thread = NULL;
}
idle->idle_thread = NULL;
if (thread)
g_thread_join (thread);
- g_mutex_free (idle->idle_lock);
-
- if (idle->start_watch_cond != NULL)
- g_cond_free (idle->start_watch_cond);
-
- if (idle->start_watch_mutex != NULL)
- g_mutex_free (idle->start_watch_mutex);
+ g_mutex_clear (&idle->idle_lock);
+ g_cond_clear (&idle->start_watch_cond);
+ g_mutex_clear (&idle->start_watch_mutex);
g_free (is->idle);
is->idle = NULL;
idle->state = IMAPX_IDLE_PENDING;
if (!idle->idle_thread) {
- idle->start_watch_cond = g_cond_new ();
- idle->start_watch_mutex = g_mutex_new ();
+ g_cond_init (&idle->start_watch_cond);
+ g_mutex_init (&idle->start_watch_mutex);
idle->start_watch_is_set = FALSE;
- idle->idle_thread = g_thread_create (
- (GThreadFunc) imapx_idle_thread, is, TRUE, NULL);
+ idle->idle_thread = g_thread_new (NULL,
+ (GThreadFunc) imapx_idle_thread, is);
} else {
- g_mutex_lock (idle->start_watch_mutex);
+ g_mutex_lock (&idle->start_watch_mutex);
idle->start_watch_is_set = TRUE;
- g_cond_broadcast (idle->start_watch_cond);
- g_mutex_unlock (idle->start_watch_mutex);
+ g_cond_broadcast (&idle->start_watch_cond);
+ g_mutex_unlock (&idle->start_watch_mutex);
}
IDLE_UNLOCK (idle);
is->active = NULL;
is->done = NULL;
- g_static_rec_mutex_free (&is->queue_lock);
- g_mutex_free (is->fetch_mutex);
- g_cond_free (is->fetch_cond);
+ g_rec_mutex_clear (&is->queue_lock);
+ g_mutex_clear (&is->fetch_mutex);
+ g_cond_clear (&is->fetch_cond);
camel_folder_change_info_free (is->changes);
/* not used at the moment. Use it in future */
is->job_timeout = 29 * 60 * 1000 * 1000;
- g_static_rec_mutex_init (&is->queue_lock);
+ g_rec_mutex_init (&is->queue_lock);
is->state = IMAPX_DISCONNECTED;
is->changes = camel_folder_change_info_new ();
is->parser_quit = FALSE;
- is->fetch_mutex = g_mutex_new ();
- is->fetch_cond = g_cond_new ();
+ g_mutex_init (&is->fetch_mutex);
+ g_cond_init (&is->fetch_cond);
}
CamelIMAPXServer *
if (!imapx_reconnect (is, cancellable, error))
return FALSE;
- is->parser_thread = g_thread_create ((GThreadFunc) imapx_parser_thread, is, TRUE, NULL);
+ is->parser_thread = g_thread_new (NULL, (GThreadFunc) imapx_parser_thread, is);
return TRUE;
}
do {
gint this;
- g_mutex_lock (is->fetch_mutex);
+ g_mutex_lock (&is->fetch_mutex);
this = is->fetch_count;
QUEUE_UNLOCK (is);
while (is->fetch_count == this)
- g_cond_wait (is->fetch_cond, is->fetch_mutex);
+ g_cond_wait (&is->fetch_cond, &is->fetch_mutex);
- g_mutex_unlock (is->fetch_mutex);
+ g_mutex_unlock (&is->fetch_mutex);
QUEUE_LOCK (is);
camel_imapx_job_unref (job);
- g_mutex_lock (is->fetch_mutex);
+ g_mutex_lock (&is->fetch_mutex);
is->fetch_count++;
- g_cond_broadcast (is->fetch_cond);
- g_mutex_unlock (is->fetch_mutex);
+ g_cond_broadcast (&is->fetch_cond);
+ g_mutex_unlock (&is->fetch_mutex);
return stream;
}
/* Current command/work queue. All commands are stored in one list,
* all the time, so they can be cleaned up in exception cases */
- GStaticRecMutex queue_lock;
+ GRecMutex queue_lock;
CamelIMAPXCommand *literal;
CamelIMAPXCommandQueue *queue;
CamelIMAPXCommandQueue *active;
gboolean use_qresync;
/* used to synchronize duplicate get_message requests */
- GCond *fetch_cond;
- GMutex *fetch_mutex;
+ GCond fetch_cond;
+ GMutex fetch_mutex;
gint fetch_count;
};
((obj), CAMEL_TYPE_IMAPX_SETTINGS, CamelIMAPXSettingsPrivate))
struct _CamelIMAPXSettingsPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *namespace;
gchar *shell_command;
priv = CAMEL_IMAPX_SETTINGS_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->namespace);
g_free (priv->shell_command);
camel_imapx_settings_init (CamelIMAPXSettings *settings)
{
settings->priv = CAMEL_IMAPX_SETTINGS_GET_PRIVATE (settings);
- settings->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&settings->priv->property_lock);
}
/**
g_return_val_if_fail (CAMEL_IS_IMAPX_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imapx_settings_get_namespace (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (namespace_ == NULL)
namespace_ = "";
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->namespace, namespace_) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->namespace);
settings->priv->namespace = g_strdup (namespace_);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "namespace");
}
g_return_val_if_fail (CAMEL_IS_IMAPX_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imapx_settings_get_shell_command (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (shell_command != NULL && *shell_command == '\0')
shell_command = NULL;
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->shell_command, shell_command) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->shell_command);
settings->priv->shell_command = g_strdup (shell_command);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "shell-command");
}
{
CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (object);
- g_mutex_free (imapx_store->get_finfo_lock);
+ g_mutex_clear (&imapx_store->get_finfo_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_imapx_store_parent_class)->finalize (object);
if (top == NULL)
top = "";
- g_mutex_lock (istore->get_finfo_lock);
+ g_mutex_lock (&istore->get_finfo_lock);
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
fi = get_folder_info_offline (store, top, flags, error);
- g_mutex_unlock (istore->get_finfo_lock);
+ g_mutex_unlock (&istore->get_finfo_lock);
return fi;
}
}
fi = get_folder_info_offline (store, top, flags, error);
- g_mutex_unlock (istore->get_finfo_lock);
+ g_mutex_unlock (&istore->get_finfo_lock);
return fi;
}
if (!camel_service_connect_sync (
CAMEL_SERVICE (store), cancellable, error)) {
- g_mutex_unlock (istore->get_finfo_lock);
+ g_mutex_unlock (&istore->get_finfo_lock);
return NULL;
}
if (*top && flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST) {
fi = get_folder_info_offline (store, top, flags, error);
- g_mutex_unlock (istore->get_finfo_lock);
+ g_mutex_unlock (&istore->get_finfo_lock);
return fi;
}
}
if (!sync_folders (istore, pattern, TRUE, cancellable, error)) {
- g_mutex_unlock (istore->get_finfo_lock);
+ g_mutex_unlock (&istore->get_finfo_lock);
return NULL;
}
discover_inbox (store, cancellable);
fi = get_folder_info_offline (store, top, flags, error);
- g_mutex_unlock (istore->get_finfo_lock);
+ g_mutex_unlock (&istore->get_finfo_lock);
return fi;
}
static void
camel_imapx_store_init (CamelIMAPXStore *istore)
{
- istore->get_finfo_lock = g_mutex_new ();
+ g_mutex_init (&istore->get_finfo_lock);
istore->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
istore->dir_sep = '/';
istore->con_man = camel_imapx_conn_manager_new (CAMEL_STORE (istore));
/* Used for syncronizing get_folder_info. Check for re-use of any other lock. At the
* moment, could not find anything suitable for this */
- GMutex *get_finfo_lock;
+ GMutex get_finfo_lock;
time_t last_refresh_time;
/* hash table of UIDs to ignore as recent when updating folder */
((obj), CAMEL_TYPE_LOCAL_SETTINGS, CamelLocalSettingsPrivate))
struct _CamelLocalSettingsPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *path;
};
priv = CAMEL_LOCAL_SETTINGS_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->path);
camel_local_settings_init (CamelLocalSettings *settings)
{
settings->priv = CAMEL_LOCAL_SETTINGS_GET_PRIVATE (settings);
- settings->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&settings->priv->property_lock);
}
/**
g_return_val_if_fail (CAMEL_IS_LOCAL_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_local_settings_get_path (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
}
}
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
new_path = g_strndup (path, length);
if (g_strcmp0 (settings->priv->path, new_path) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_free (new_path);
return;
}
g_free (settings->priv->path);
settings->priv->path = new_path;
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "path");
}
/* see also camel-lock.c */
#define _(x) (x)
-static GStaticMutex lock_lock = G_STATIC_MUTEX_INIT;
-#define LOCK() g_static_mutex_lock(&lock_lock)
-#define UNLOCK() g_static_mutex_unlock(&lock_lock)
+static GMutex lock_lock;
+#define LOCK() g_mutex_lock(&lock_lock)
+#define UNLOCK() g_mutex_unlock(&lock_lock)
static gint lock_sequence;
static gint lock_helper_pid = -1;
gchar *
camel_header_msgid_generate (void)
{
- static GStaticMutex count_lock = G_STATIC_MUTEX_INIT;
-#define COUNT_LOCK() g_static_mutex_lock (&count_lock)
-#define COUNT_UNLOCK() g_static_mutex_unlock (&count_lock)
+ static GMutex count_lock;
+#define COUNT_LOCK() g_mutex_lock (&count_lock)
+#define COUNT_UNLOCK() g_mutex_unlock (&count_lock)
gchar host[MAXHOSTNAMELEN];
const gchar *name;
static gint count = 0;
}
/**
- * camel_msgport_timed_pop:
+ * camel_msgport_timeout_pop:
* @msgport: a #CamelMsgPort
- * @end_time: a #GTimeVal
+ * @timeout: number of microseconds to wait
*
- * Since: 2.30
+ * Since: 3.8
**/
CamelMsg *
-camel_msgport_timed_pop (CamelMsgPort *msgport,
- GTimeVal *end_time)
+camel_msgport_timeout_pop (CamelMsgPort *msgport,
+ guint64 timeout)
{
CamelMsg *msg;
g_async_queue_lock (msgport->queue);
- msg = g_async_queue_timed_pop_unlocked (msgport->queue, end_time);
+ msg = g_async_queue_timeout_pop_unlocked (msgport->queue, timeout);
if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
msgport_sync_with_pipe (msgport->pipe[0]);
CamelMsg *msg);
CamelMsg * camel_msgport_pop (CamelMsgPort *msgport);
CamelMsg * camel_msgport_try_pop (CamelMsgPort *msgport);
-CamelMsg * camel_msgport_timed_pop (CamelMsgPort *msgport, GTimeVal *end_time);
+CamelMsg * camel_msgport_timeout_pop (CamelMsgPort *msgport,
+ guint64 timeout);
void camel_msgport_reply (CamelMsg *msg);
struct PRFileDesc * camel_msgport_prfd (CamelMsgPort *msgport);
reply_port = msg->msg.reply_port = camel_msgport_new ();
fd = camel_msgport_fd (msg->msg.reply_port);
- if ((thread = g_thread_create (worker, msg, TRUE, error)) != NULL) {
+ if ((thread = g_thread_new (NULL, worker, msg)) != NULL) {
gint status;
#ifndef G_OS_WIN32
GPollFD polls[2];
gpointer key;
gint waiters;
GThread *owner;
- GCond *cond;
+ GCond cond;
};
struct _CamelObjectBag {
CamelCopyFunc key_copy_func;
GFreeFunc key_free_func;
GList *reserved; /* list of KeyReservations */
- GMutex *mutex;
+ GMutex mutex;
};
static KeyReservation *
reservation = g_slice_new0 (KeyReservation);
reservation->key = bag->key_copy_func (key);
reservation->owner = g_thread_self ();
- reservation->cond = g_cond_new ();
+ g_cond_init (&reservation->cond);
bag->reserved = g_list_prepend (bag->reserved, reservation);
bag->reserved = g_list_remove (bag->reserved, reservation);
bag->key_free_func (reservation->key);
- g_cond_free (reservation->cond);
+ g_cond_clear (&reservation->cond);
g_slice_free (KeyReservation, reservation);
}
gpointer key;
if (is_last_ref) {
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
/* first remove from bag */
key = g_hash_table_lookup (bag->key_table, object);
g_hash_table_remove (bag->object_table, key);
}
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
/* then free the object */
g_object_remove_toggle_ref (object, object_bag_toggle_notify, bag);
if (reservation->waiters > 0) {
reservation->owner = NULL;
- g_cond_signal (reservation->cond);
+ g_cond_signal (&reservation->cond);
} else
key_reservation_free (bag, reservation);
}
bag->key_equal_func = key_equal_func;
bag->key_copy_func = key_copy_func;
bag->key_free_func = key_free_func;
- bag->mutex = g_mutex_new ();
+ g_mutex_init (&bag->mutex);
return bag;
}
g_return_val_if_fail (bag != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
/* Look for the key in the bag. */
object = g_hash_table_lookup (bag->object_table, key);
if (object != NULL) {
g_object_ref (object);
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return object;
}
reservation = key_reservation_lookup (bag, key);
if (reservation == NULL) {
/* No such key, so return NULL. */
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return NULL;
}
/* Wait for the key to be unreserved. */
reservation->waiters++;
while (reservation->owner != NULL)
- g_cond_wait (reservation->cond, bag->mutex);
+ g_cond_wait (&reservation->cond, &bag->mutex);
reservation->waiters--;
/* Check if an object was added by another thread. */
reservation->owner = g_thread_self ();
object_bag_unreserve (bag, key);
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return object;
}
g_return_val_if_fail (bag != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
object = g_hash_table_lookup (bag->object_table, key);
if (object != NULL)
g_object_ref (object);
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return object;
}
g_return_val_if_fail (bag != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
/* If object for key already exists, return it immediately. */
object = g_hash_table_lookup (bag->object_table, key);
if (object != NULL) {
g_object_ref (object);
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return object;
}
reservation = key_reservation_lookup (bag, key);
if (reservation == NULL) {
key_reservation_new (bag, key);
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return NULL;
}
/* Wait for the reservation to be committed or aborted. */
reservation->waiters++;
while (reservation->owner != NULL)
- g_cond_wait (reservation->cond, bag->mutex);
+ g_cond_wait (&reservation->cond, &bag->mutex);
reservation->owner = g_thread_self ();
reservation->waiters--;
g_object_ref (object);
}
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return object;
}
g_return_if_fail (key != NULL);
g_return_if_fail (G_IS_OBJECT (object));
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
if (g_hash_table_lookup (bag->key_table, object) == NULL) {
gpointer copied_key;
object_bag_toggle_notify, bag);
}
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
}
/**
g_return_if_fail (bag != NULL);
g_return_if_fail (key != NULL);
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
object_bag_unreserve (bag, key);
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
}
/**
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (new_key != NULL);
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
key = g_hash_table_lookup (bag->key_table, object);
if (key != NULL) {
} else
g_warn_if_reached ();
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
}
/**
array = g_ptr_array_new ();
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
values = g_hash_table_get_values (bag->object_table);
while (values != NULL) {
values = g_list_delete_link (values, values);
}
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
return array;
}
g_return_if_fail (bag != NULL);
g_return_if_fail (G_IS_OBJECT (object));
- g_mutex_lock (bag->mutex);
+ g_mutex_lock (&bag->mutex);
key = g_hash_table_lookup (bag->key_table, object);
if (key != NULL) {
g_hash_table_remove (bag->object_table, key);
}
- g_mutex_unlock (bag->mutex);
+ g_mutex_unlock (&bag->mutex);
}
/**
g_hash_table_destroy (bag->key_table);
g_hash_table_destroy (bag->object_table);
- g_mutex_free (bag->mutex);
+ g_mutex_clear (&bag->mutex);
g_slice_free (CamelObjectBag, bag);
}
LAST_SIGNAL
};
-static GStaticRecMutex operation_lock = G_STATIC_REC_MUTEX_INIT;
-#define LOCK() g_static_rec_mutex_lock (&operation_lock)
-#define UNLOCK() g_static_rec_mutex_unlock (&operation_lock)
+static GRecMutex operation_lock;
+#define LOCK() g_rec_mutex_lock (&operation_lock)
+#define UNLOCK() g_rec_mutex_unlock (&operation_lock)
static GQueue operation_list = G_QUEUE_INIT;
#define k(x) /*(printf ("%s (%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__),(x))*/
#define CAMEL_PARTITION_TABLE_LOCK(kf, lock) \
- (g_static_mutex_lock (&(kf)->priv->lock))
+ (g_mutex_lock (&(kf)->priv->lock))
#define CAMEL_PARTITION_TABLE_UNLOCK(kf, lock) \
- (g_static_mutex_unlock (&(kf)->priv->lock))
+ (g_mutex_unlock (&(kf)->priv->lock))
#define CAMEL_PARTITION_TABLE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), CAMEL_TYPE_PARTITION_TABLE, CamelPartitionTablePrivate))
struct _CamelPartitionTablePrivate {
- GStaticMutex lock; /* for locking partition */
+ GMutex lock; /* for locking partition */
};
G_DEFINE_TYPE (CamelPartitionTable, camel_partition_table, CAMEL_TYPE_OBJECT)
g_object_unref (table->blocks);
}
- g_static_mutex_free (&table->priv->lock);
+ g_mutex_clear (&table->priv->lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_partition_table_parent_class)->finalize (object);
cpi->priv = CAMEL_PARTITION_TABLE_GET_PRIVATE (cpi);
g_queue_init (&cpi->partition);
- g_static_mutex_init (&cpi->priv->lock);
+ g_mutex_init (&cpi->priv->lock);
}
/* ********************************************************************** */
((obj), CAMEL_TYPE_KEY_TABLE, CamelKeyTablePrivate))
#define CAMEL_KEY_TABLE_LOCK(kf, lock) \
- (g_static_mutex_lock (&(kf)->priv->lock))
+ (g_mutex_lock (&(kf)->priv->lock))
#define CAMEL_KEY_TABLE_UNLOCK(kf, lock) \
- (g_static_mutex_unlock (&(kf)->priv->lock))
+ (g_mutex_unlock (&(kf)->priv->lock))
struct _CamelKeyTablePrivate {
- GStaticMutex lock; /* for locking key */
+ GMutex lock; /* for locking key */
};
G_DEFINE_TYPE (CamelKeyTable, camel_key_table, CAMEL_TYPE_OBJECT)
g_object_unref (table->blocks);
}
- g_static_mutex_free (&table->priv->lock);
+ g_mutex_clear (&table->priv->lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_key_table_parent_class)->finalize (object);
camel_key_table_init (CamelKeyTable *table)
{
table->priv = CAMEL_KEY_TABLE_GET_PRIVATE (table);
- g_static_mutex_init (&table->priv->lock);
+ g_mutex_init (&table->priv->lock);
}
CamelKeyTable *
static GHashTable *module_table;
/* table of CamelProvider's */
static GHashTable *provider_table;
-static GStaticRecMutex provider_lock = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex provider_lock;
-#define LOCK() (g_static_rec_mutex_lock(&provider_lock))
-#define UNLOCK() (g_static_rec_mutex_unlock(&provider_lock))
+#define LOCK() (g_rec_mutex_lock(&provider_lock))
+#define UNLOCK() (g_rec_mutex_unlock(&provider_lock))
/* The vfolder provider is always available */
static CamelProvider vee_provider = {
/* use 1 hour as our pop timeout */
#define POPB4SMTP_TIMEOUT (60*60)
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define POPB4SMTP_LOCK(l) g_static_mutex_lock(&l)
-#define POPB4SMTP_UNLOCK(l) g_static_mutex_unlock(&l)
+static GMutex lock;
+#define POPB4SMTP_LOCK(l) g_mutex_lock(&l)
+#define POPB4SMTP_UNLOCK(l) g_mutex_unlock(&l)
G_DEFINE_TYPE (CamelSaslPOPB4SMTP, camel_sasl_popb4smtp, CAMEL_TYPE_SASL)
gpointer session; /* weak pointer */
CamelSettings *settings;
- GMutex *settings_lock;
+ GMutex settings_lock;
CamelProvider *provider;
gchar *uid;
gchar *password;
- GMutex *connection_lock;
+ GMutex connection_lock;
ConnectionOp *connection_op;
CamelServiceConnectionStatus status;
};
success = class->connect_finish (service, result, &error);
CAMEL_CHECK_GERROR (service, connect_sync, success, p_error);
- g_mutex_lock (service->priv->connection_lock);
+ g_mutex_lock (&service->priv->connection_lock);
if (service->priv->connection_op == op) {
connection_op_unref (service->priv->connection_op);
connection_op_complete (op, error);
connection_op_complete_pending (op, error);
- g_mutex_unlock (service->priv->connection_lock);
+ g_mutex_unlock (&service->priv->connection_lock);
connection_op_unref (op);
g_clear_error (&error);
success = class->disconnect_finish (service, result, &error);
CAMEL_CHECK_GERROR (service, disconnect_sync, success, p_error);
- g_mutex_lock (service->priv->connection_lock);
+ g_mutex_lock (&service->priv->connection_lock);
if (service->priv->connection_op == op) {
connection_op_unref (service->priv->connection_op);
connection_op_complete (op, error);
connection_op_complete_pending (op, error);
- g_mutex_unlock (service->priv->connection_lock);
+ g_mutex_unlock (&service->priv->connection_lock);
connection_op_unref (op);
g_clear_error (&error);
CAMEL_SERVICE_GET_CLASS (object)->disconnect_sync (
CAMEL_SERVICE (object), TRUE, NULL, NULL);
- g_mutex_free (priv->settings_lock);
+ g_mutex_clear (&priv->settings_lock);
g_free (priv->display_name);
g_free (priv->user_data_dir);
/* There should be no outstanding connection operations. */
g_warn_if_fail (priv->connection_op == NULL);
- g_mutex_free (priv->connection_lock);
+ g_mutex_clear (&priv->connection_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_service_parent_class)->finalize (object);
{
service->priv = CAMEL_SERVICE_GET_PRIVATE (service);
- service->priv->settings_lock = g_mutex_new ();
- service->priv->connection_lock = g_mutex_new ();
+ g_mutex_init (&service->priv->settings_lock);
+ g_mutex_init (&service->priv->connection_lock);
service->priv->status = CAMEL_SERVICE_DISCONNECTED;
}
/* Every service should have a settings object. */
g_return_val_if_fail (service->priv->settings != NULL, NULL);
- g_mutex_lock (service->priv->settings_lock);
+ g_mutex_lock (&service->priv->settings_lock);
settings = g_object_ref (service->priv->settings);
- g_mutex_unlock (service->priv->settings_lock);
+ g_mutex_unlock (&service->priv->settings_lock);
return settings;
}
settings = g_object_new (class->settings_type, NULL);
}
- g_mutex_lock (service->priv->settings_lock);
+ g_mutex_lock (&service->priv->settings_lock);
if (service->priv->settings != NULL)
g_object_unref (service->priv->settings);
service->priv->settings = settings; /* takes ownership */
- g_mutex_unlock (service->priv->settings_lock);
+ g_mutex_unlock (&service->priv->settings_lock);
g_object_notify (G_OBJECT (service), "settings");
}
g_simple_async_result_set_check_cancellable (simple, cancellable);
- g_mutex_lock (service->priv->connection_lock);
+ g_mutex_lock (&service->priv->connection_lock);
switch (service->priv->status) {
g_warn_if_reached ();
}
- g_mutex_unlock (service->priv->connection_lock);
+ g_mutex_unlock (&service->priv->connection_lock);
g_object_unref (simple);
}
g_simple_async_result_set_check_cancellable (simple, cancellable);
- g_mutex_lock (service->priv->connection_lock);
+ g_mutex_lock (&service->priv->connection_lock);
switch (service->priv->status) {
g_warn_if_reached ();
}
- g_mutex_unlock (service->priv->connection_lock);
+ g_mutex_unlock (&service->priv->connection_lock);
g_object_unref (simple);
}
gchar *user_cache_dir;
GHashTable *services;
- GMutex *services_lock;
+ GMutex services_lock;
GHashTable *junk_headers;
CamelJunkFilter *junk_filter;
if (priv->main_context != NULL)
g_main_context_unref (priv->main_context);
- g_mutex_free (priv->services_lock);
+ g_mutex_clear (&priv->services_lock);
if (priv->junk_headers) {
g_hash_table_remove_all (priv->junk_headers);
session, "uid", uid, NULL);
if (service != NULL) {
- g_mutex_lock (session->priv->services_lock);
+ g_mutex_lock (&session->priv->services_lock);
g_hash_table_insert (
session->priv->services,
g_strdup (uid),
g_object_ref (service));
- g_mutex_unlock (session->priv->services_lock);
+ g_mutex_unlock (&session->priv->services_lock);
}
return service;
{
const gchar *uid;
- g_mutex_lock (session->priv->services_lock);
+ g_mutex_lock (&session->priv->services_lock);
uid = camel_service_get_uid (service);
g_hash_table_remove (session->priv->services, uid);
- g_mutex_unlock (session->priv->services_lock);
+ g_mutex_unlock (&session->priv->services_lock);
}
static void
session->priv = CAMEL_SESSION_GET_PRIVATE (session);
session->priv->services = services;
- session->priv->services_lock = g_mutex_new ();
+ g_mutex_init (&session->priv->services_lock);
session->priv->junk_headers = NULL;
session->priv->main_context = g_main_context_ref_thread_default ();
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
g_return_val_if_fail (uid != NULL, NULL);
- g_mutex_lock (session->priv->services_lock);
+ g_mutex_lock (&session->priv->services_lock);
service = g_hash_table_lookup (session->priv->services, uid);
if (service != NULL)
g_object_ref (service);
- g_mutex_unlock (session->priv->services_lock);
+ g_mutex_unlock (&session->priv->services_lock);
return service;
}
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
- g_mutex_lock (session->priv->services_lock);
+ g_mutex_lock (&session->priv->services_lock);
list = g_hash_table_get_values (session->priv->services);
g_list_foreach (list, (GFunc) g_object_ref, NULL);
- g_mutex_unlock (session->priv->services_lock);
+ g_mutex_unlock (&session->priv->services_lock);
return list;
}
{
g_return_if_fail (CAMEL_IS_SESSION (session));
- g_mutex_lock (session->priv->services_lock);
+ g_mutex_lock (&session->priv->services_lock);
g_hash_table_remove_all (session->priv->services);
- g_mutex_unlock (session->priv->services_lock);
+ g_mutex_unlock (&session->priv->services_lock);
}
/**
((obj), CAMEL_TYPE_STORE_SUMMARY, CamelStoreSummaryPrivate))
struct _CamelStoreSummaryPrivate {
- GStaticRecMutex summary_lock; /* for the summary hashtable/array */
- GStaticRecMutex io_lock; /* load/save lock, for access to saved_count, etc */
- GStaticRecMutex ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before CAMEL_STORE_SUMMARY_SUMMARY_LOCK */
+ GRecMutex summary_lock; /* for the summary hashtable/array */
+ GRecMutex io_lock; /* load/save lock, for access to saved_count, etc */
+ GRecMutex ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before CAMEL_STORE_SUMMARY_SUMMARY_LOCK */
GHashTable *folder_summaries; /* CamelFolderSummary->path; doesn't add reference to CamelFolderSummary */
if (summary->store_info_chunks != NULL)
camel_memchunk_destroy (summary->store_info_chunks);
- g_static_rec_mutex_free (&summary->priv->summary_lock);
- g_static_rec_mutex_free (&summary->priv->io_lock);
- g_static_rec_mutex_free (&summary->priv->ref_lock);
+ g_rec_mutex_clear (&summary->priv->summary_lock);
+ g_rec_mutex_clear (&summary->priv->io_lock);
+ g_rec_mutex_clear (&summary->priv->ref_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_store_summary_parent_class)->finalize (object);
summary->priv->folder_summaries = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
summary->priv->scheduled_save_id = 0;
- g_static_rec_mutex_init (&summary->priv->summary_lock);
- g_static_rec_mutex_init (&summary->priv->io_lock);
- g_static_rec_mutex_init (&summary->priv->ref_lock);
+ g_rec_mutex_init (&summary->priv->summary_lock);
+ g_rec_mutex_init (&summary->priv->io_lock);
+ g_rec_mutex_init (&summary->priv->ref_lock);
}
/**
switch (lock) {
case CAMEL_STORE_SUMMARY_SUMMARY_LOCK:
- g_static_rec_mutex_lock (&summary->priv->summary_lock);
+ g_rec_mutex_lock (&summary->priv->summary_lock);
break;
case CAMEL_STORE_SUMMARY_IO_LOCK:
- g_static_rec_mutex_lock (&summary->priv->io_lock);
+ g_rec_mutex_lock (&summary->priv->io_lock);
break;
case CAMEL_STORE_SUMMARY_REF_LOCK:
- g_static_rec_mutex_lock (&summary->priv->ref_lock);
+ g_rec_mutex_lock (&summary->priv->ref_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_STORE_SUMMARY_SUMMARY_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->summary_lock);
+ g_rec_mutex_unlock (&summary->priv->summary_lock);
break;
case CAMEL_STORE_SUMMARY_IO_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->io_lock);
+ g_rec_mutex_unlock (&summary->priv->io_lock);
break;
case CAMEL_STORE_SUMMARY_REF_LOCK:
- g_static_rec_mutex_unlock (&summary->priv->ref_lock);
+ g_rec_mutex_unlock (&summary->priv->ref_lock);
break;
default:
g_return_if_reached ();
typedef struct _SignalData SignalData;
struct _CamelStorePrivate {
- GStaticRecMutex folder_lock; /* for locking folder operations */
+ GRecMutex folder_lock; /* for locking folder operations */
};
struct _AsyncContext {
if (store->folders != NULL)
camel_object_bag_destroy (store->folders);
- g_static_rec_mutex_free (&store->priv->folder_lock);
+ g_rec_mutex_clear (&store->priv->folder_lock);
if (store->cdb_r != NULL) {
camel_db_close (store->cdb_r);
store->mode = CAMEL_STORE_READ | CAMEL_STORE_WRITE;
- g_static_rec_mutex_init (&store->priv->folder_lock);
+ g_rec_mutex_init (&store->priv->folder_lock);
}
GQuark
switch (lock) {
case CAMEL_STORE_FOLDER_LOCK:
- g_static_rec_mutex_lock (&store->priv->folder_lock);
+ g_rec_mutex_lock (&store->priv->folder_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_STORE_FOLDER_LOCK:
- g_static_rec_mutex_unlock (&store->priv->folder_lock);
+ g_rec_mutex_unlock (&store->priv->folder_lock);
break;
default:
g_return_if_reached ();
}
/* working stuff for pstrings */
-static GStaticMutex string_pool_lock = G_STATIC_MUTEX_INIT;
+static GMutex string_pool_lock;
static GHashTable *string_pool = NULL;
typedef struct _StringPoolNode StringPoolNode;
return "";
}
- g_static_mutex_lock (&string_pool_lock);
+ g_mutex_lock (&string_pool_lock);
string_pool_init ();
interned = node->string;
- g_static_mutex_unlock (&string_pool_lock);
+ g_mutex_unlock (&string_pool_lock);
return interned;
}
if (*string == '\0')
return "";
- g_static_mutex_lock (&string_pool_lock);
+ g_mutex_lock (&string_pool_lock);
string_pool_init ();
interned = node->string;
- g_static_mutex_unlock (&string_pool_lock);
+ g_mutex_unlock (&string_pool_lock);
return interned;
}
if (string == NULL || *string == '\0')
return;
- g_static_mutex_lock (&string_pool_lock);
+ g_mutex_lock (&string_pool_lock);
node = g_hash_table_lookup (string_pool, &static_node);
g_hash_table_remove (string_pool, node);
}
- g_static_mutex_unlock (&string_pool_lock);
+ g_mutex_unlock (&string_pool_lock);
}
/**
void
camel_pstring_dump_stat (void)
{
- g_static_mutex_lock (&string_pool_lock);
+ g_mutex_lock (&string_pool_lock);
g_print (" String Pool Statistics: ");
g_free (format_size);
}
- g_static_mutex_unlock (&string_pool_lock);
+ g_mutex_unlock (&string_pool_lock);
}
#define CAMEL_TEXT_INDEX_MAX_WORDLEN (36)
#define CAMEL_TEXT_INDEX_LOCK(kf, lock) \
- (g_static_rec_mutex_lock (&((CamelTextIndex *) kf)->priv->lock))
+ (g_rec_mutex_lock (&((CamelTextIndex *) kf)->priv->lock))
#define CAMEL_TEXT_INDEX_UNLOCK(kf, lock) \
- (g_static_rec_mutex_unlock (&((CamelTextIndex *) kf)->priv->lock))
+ (g_rec_mutex_unlock (&((CamelTextIndex *) kf)->priv->lock))
static gint text_index_compress_nosync (CamelIndex *idx);
guint word_cache_limit;
GQueue word_cache;
GHashTable *words;
- GStaticRecMutex lock;
+ GRecMutex lock;
};
/* Root block of text index */
g_hash_table_destroy (priv->words);
- g_static_rec_mutex_free (&priv->lock);
+ g_rec_mutex_clear (&priv->lock);
/* Chain up to parent's finalize () method. */
G_OBJECT_CLASS (camel_text_index_parent_class)->finalize (object);
* usage barely affects performance. */
text_index->priv->word_cache_limit = 4096; /* 1024 = 128K */
- g_static_rec_mutex_init (&text_index->priv->lock);
+ g_rec_mutex_init (&text_index->priv->lock);
}
static gchar *
typedef struct _AsyncContext AsyncContext;
struct _CamelTransportPrivate {
- GMutex *send_lock; /* for locking send operations */
+ GMutex send_lock; /* for locking send operations */
};
struct _AsyncContext {
priv = CAMEL_TRANSPORT_GET_PRIVATE (object);
- g_mutex_free (priv->send_lock);
+ g_mutex_clear (&priv->send_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_transport_parent_class)->finalize (object);
{
transport->priv = CAMEL_TRANSPORT_GET_PRIVATE (transport);
- transport->priv->send_lock = g_mutex_new ();
+ g_mutex_init (&transport->priv->send_lock);
}
/**
switch (lock) {
case CAMEL_TRANSPORT_SEND_LOCK:
- g_mutex_lock (transport->priv->send_lock);
+ g_mutex_lock (&transport->priv->send_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_TRANSPORT_SEND_LOCK:
- g_mutex_unlock (transport->priv->send_lock);
+ g_mutex_unlock (&transport->priv->send_lock);
break;
default:
g_return_if_reached ();
/* ----------------------------------------------------------------------- */
struct _CamelVeeDataCachePrivate {
- GMutex *sf_mutex; /* guards subfolder_hash */
+ GMutex sf_mutex; /* guards subfolder_hash */
GHashTable *subfolder_hash; /* CamelFolder * => CamelVeeSubfolderData * */
- GMutex *mi_mutex; /* guards message_info_hash */
+ GMutex mi_mutex; /* guards message_info_hash */
GHashTable *orig_message_uid_hash; /* VeeData * => CamelVeeMessageInfoData * */
GHashTable *vee_message_uid_hash; /* const gchar *vee_uid => CamelVeeMessageInfoData * */
};
if (data_cache->priv->vee_message_uid_hash)
g_hash_table_destroy (data_cache->priv->vee_message_uid_hash);
data_cache->priv->vee_message_uid_hash = NULL;
-
- if (data_cache->priv->sf_mutex)
- g_mutex_free (data_cache->priv->sf_mutex);
- data_cache->priv->sf_mutex = NULL;
-
- if (data_cache->priv->mi_mutex)
- g_mutex_free (data_cache->priv->mi_mutex);
- data_cache->priv->mi_mutex = NULL;
}
/* Chain up to parent's dispose () method. */
}
static void
+camel_vee_data_cache_finalize (GObject *object)
+{
+ CamelVeeDataCache *data_cache;
+
+ data_cache = CAMEL_VEE_DATA_CACHE (object);
+ if (data_cache->priv) {
+ g_mutex_clear (&data_cache->priv->sf_mutex);
+ g_mutex_clear (&data_cache->priv->mi_mutex);
+ }
+
+ /* Chain up to parent's finalize () method. */
+ G_OBJECT_CLASS (camel_vee_data_cache_parent_class)->finalize (object);
+}
+
+static void
camel_vee_data_cache_class_init (CamelVeeDataCacheClass *class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
object_class->dispose = camel_vee_data_cache_dispose;
+ object_class->finalize = camel_vee_data_cache_finalize;
}
static void
{
data_cache->priv = G_TYPE_INSTANCE_GET_PRIVATE (data_cache, CAMEL_TYPE_VEE_DATA_CACHE, CamelVeeDataCachePrivate);
- data_cache->priv->sf_mutex = g_mutex_new ();
+ g_mutex_init (&data_cache->priv->sf_mutex);
data_cache->priv->subfolder_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
- data_cache->priv->mi_mutex = g_mutex_new ();
+ g_mutex_init (&data_cache->priv->mi_mutex);
data_cache->priv->orig_message_uid_hash = g_hash_table_new_full (vee_data_hash, vee_data_equal, g_free, g_object_unref);
data_cache->priv->vee_message_uid_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
}
g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
g_return_if_fail (CAMEL_IS_FOLDER (subfolder));
- g_mutex_lock (data_cache->priv->mi_mutex);
- g_mutex_lock (data_cache->priv->sf_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->sf_mutex);
sf_data = g_hash_table_lookup (data_cache->priv->subfolder_hash, subfolder);
if (!sf_data) {
}
}
- g_mutex_unlock (data_cache->priv->sf_mutex);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->sf_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
}
static gboolean
g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
g_return_if_fail (CAMEL_IS_FOLDER (subfolder));
- g_mutex_lock (data_cache->priv->mi_mutex);
- g_mutex_lock (data_cache->priv->sf_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->sf_mutex);
g_hash_table_foreach_remove (data_cache->priv->vee_message_uid_hash, remove_vee_by_folder_cb, subfolder);
g_hash_table_foreach_remove (data_cache->priv->orig_message_uid_hash, remove_orig_by_folder_cb, subfolder);
g_hash_table_remove (data_cache->priv->subfolder_hash, subfolder);
- g_mutex_unlock (data_cache->priv->sf_mutex);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->sf_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
}
/**
g_return_val_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache), NULL);
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_mutex_lock (data_cache->priv->sf_mutex);
+ g_mutex_lock (&data_cache->priv->sf_mutex);
res = g_hash_table_lookup (data_cache->priv->subfolder_hash, folder);
if (!res) {
g_object_ref (res);
- g_mutex_unlock (data_cache->priv->sf_mutex);
+ g_mutex_unlock (&data_cache->priv->sf_mutex);
return res;
}
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
g_return_val_if_fail (orig_message_uid != NULL, FALSE);
- g_mutex_lock (data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
/* make sure the orig_message_uid comes from the string pool */
vdata.folder = folder;
camel_pstring_free (vdata.orig_message_uid);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
return res;
}
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (orig_message_uid != NULL, NULL);
- g_mutex_lock (data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
/* make sure the orig_message_uid comes from the string pool */
vdata.folder = folder;
sf_data = camel_vee_data_cache_get_subfolder_data (data_cache, folder);
if (!sf_data) {
camel_pstring_free (vdata.orig_message_uid);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
g_return_val_if_fail (sf_data != NULL, NULL);
}
camel_pstring_free (vdata.orig_message_uid);
g_object_ref (res);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
return res;
}
g_return_val_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache), NULL);
g_return_val_if_fail (vee_message_uid != NULL, NULL);
- g_mutex_lock (data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
/* make sure vee_message_uid comes from the string pool */
vuid = camel_pstring_strdup (vee_message_uid);
if (res)
g_object_ref (res);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
camel_pstring_free (vuid);
g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
g_return_if_fail (func != NULL);
- g_mutex_lock (data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
fmd.fromfolder = fromfolder;
fmd.func = func;
g_hash_table_foreach (data_cache->priv->orig_message_uid_hash, cvdc_foreach_mi_data_cb, &fmd);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
}
/**
g_return_if_fail (CAMEL_IS_VEE_DATA_CACHE (data_cache));
g_return_if_fail (CAMEL_IS_VEE_MESSAGE_INFO_DATA (mi_data));
- g_mutex_lock (data_cache->priv->mi_mutex);
+ g_mutex_lock (&data_cache->priv->mi_mutex);
g_object_ref (mi_data);
g_object_unref (mi_data);
- g_mutex_unlock (data_cache->priv->mi_mutex);
+ g_mutex_unlock (&data_cache->priv->mi_mutex);
}
GAsyncQueue *change_queue;
gboolean change_queue_busy;
- GStaticRecMutex summary_lock; /* for locking vfolder summary */
- GStaticRecMutex subfolder_lock; /* for locking the subfolder list */
- GStaticRecMutex changed_lock; /* for locking the folders-changed list */
+ GRecMutex summary_lock; /* for locking vfolder summary */
+ GRecMutex subfolder_lock; /* for locking the subfolder list */
+ GRecMutex changed_lock; /* for locking the folders-changed list */
gchar *expression; /* query expression */
g_hash_table_foreach (vf->priv->skipped_changes, free_change_info_cb, NULL);
- g_static_rec_mutex_free (&vf->priv->summary_lock);
- g_static_rec_mutex_free (&vf->priv->subfolder_lock);
- g_static_rec_mutex_free (&vf->priv->changed_lock);
+ g_rec_mutex_clear (&vf->priv->summary_lock);
+ g_rec_mutex_clear (&vf->priv->subfolder_lock);
+ g_rec_mutex_clear (&vf->priv->changed_lock);
g_hash_table_destroy (vf->priv->ignore_changed);
g_hash_table_destroy (vf->priv->skipped_changes);
g_hash_table_destroy (vf->priv->unmatched_add_changed);
CAMEL_MESSAGE_FLAGGED |
CAMEL_MESSAGE_SEEN;
- g_static_rec_mutex_init (&vee_folder->priv->summary_lock);
- g_static_rec_mutex_init (&vee_folder->priv->subfolder_lock);
- g_static_rec_mutex_init (&vee_folder->priv->changed_lock);
+ g_rec_mutex_init (&vee_folder->priv->summary_lock);
+ g_rec_mutex_init (&vee_folder->priv->subfolder_lock);
+ g_rec_mutex_init (&vee_folder->priv->changed_lock);
vee_folder->priv->auto_update = TRUE;
vee_folder->priv->ignore_changed = g_hash_table_new (g_direct_hash, g_direct_equal);
switch (lock) {
case CAMEL_VEE_FOLDER_SUMMARY_LOCK:
- g_static_rec_mutex_lock (&folder->priv->summary_lock);
+ g_rec_mutex_lock (&folder->priv->summary_lock);
break;
case CAMEL_VEE_FOLDER_SUBFOLDER_LOCK:
- g_static_rec_mutex_lock (&folder->priv->subfolder_lock);
+ g_rec_mutex_lock (&folder->priv->subfolder_lock);
break;
case CAMEL_VEE_FOLDER_CHANGED_LOCK:
- g_static_rec_mutex_lock (&folder->priv->changed_lock);
+ g_rec_mutex_lock (&folder->priv->changed_lock);
break;
default:
g_return_if_reached ();
switch (lock) {
case CAMEL_VEE_FOLDER_SUMMARY_LOCK:
- g_static_rec_mutex_unlock (&folder->priv->summary_lock);
+ g_rec_mutex_unlock (&folder->priv->summary_lock);
break;
case CAMEL_VEE_FOLDER_SUBFOLDER_LOCK:
- g_static_rec_mutex_unlock (&folder->priv->subfolder_lock);
+ g_rec_mutex_unlock (&folder->priv->subfolder_lock);
break;
case CAMEL_VEE_FOLDER_CHANGED_LOCK:
- g_static_rec_mutex_unlock (&folder->priv->changed_lock);
+ g_rec_mutex_unlock (&folder->priv->changed_lock);
break;
default:
g_return_if_reached ();
CamelVeeFolder *unmatched_folder;
gboolean unmatched_enabled;
- GMutex *sf_counts_mutex;
+ GMutex sf_counts_mutex;
GHashTable *subfolder_usage_counts; /* CamelFolder * (subfolder) => gint of usages, for unmatched_folder */
- GMutex *vu_counts_mutex;
+ GMutex vu_counts_mutex;
GHashTable *vuid_usage_counts; /* gchar * (vuid) => gint of usages, those with 0 comes to unmatched_folder */
};
g_object_unref (vee_store->priv->vee_data_cache);
g_hash_table_destroy (vee_store->priv->subfolder_usage_counts);
g_hash_table_destroy (vee_store->priv->vuid_usage_counts);
- g_mutex_free (vee_store->priv->sf_counts_mutex);
- g_mutex_free (vee_store->priv->vu_counts_mutex);
+ g_mutex_clear (&vee_store->priv->sf_counts_mutex);
+ g_mutex_clear (&vee_store->priv->vu_counts_mutex);
/* Chain up to parent's finalize () method. */
G_OBJECT_CLASS (camel_vee_store_parent_class)->finalize (object);
vee_store->priv->unmatched_folder, CAMEL_STORE_FOLDER_PRIVATE);
vee_store->priv->subfolder_usage_counts = g_hash_table_new (g_direct_hash, g_direct_equal);
vee_store->priv->vuid_usage_counts = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify) camel_pstring_free, NULL);
- vee_store->priv->sf_counts_mutex = g_mutex_new ();
- vee_store->priv->vu_counts_mutex = g_mutex_new ();
+ g_mutex_init (&vee_store->priv->sf_counts_mutex);
+ g_mutex_init (&vee_store->priv->vu_counts_mutex);
}
static void
used_by == vstore->priv->unmatched_folder)
return;
- g_mutex_lock (vstore->priv->sf_counts_mutex);
+ g_mutex_lock (&vstore->priv->sf_counts_mutex);
counts = GPOINTER_TO_INT (g_hash_table_lookup (vstore->priv->subfolder_usage_counts, subfolder));
counts++;
camel_vee_data_cache_add_subfolder (vstore->priv->vee_data_cache, subfolder);
- g_mutex_lock (vstore->priv->vu_counts_mutex);
+ g_mutex_lock (&vstore->priv->vu_counts_mutex);
/* all messages from the folder are unmatched at the beginning */
atud.unmatched_folder = vstore->priv->unmatched_folder;
add_to_unmatched_folder_cb, &atud);
camel_folder_thaw (unmatched_folder);
- g_mutex_unlock (vstore->priv->vu_counts_mutex);
+ g_mutex_unlock (&vstore->priv->vu_counts_mutex);
if (camel_folder_change_info_changed (atud.changes))
camel_folder_changed (unmatched_folder, atud.changes);
camel_folder_change_info_free (atud.changes);
}
- g_mutex_unlock (vstore->priv->sf_counts_mutex);
+ g_mutex_unlock (&vstore->priv->sf_counts_mutex);
}
static void
unused_by == vstore->priv->unmatched_folder)
return;
- g_mutex_lock (vstore->priv->sf_counts_mutex);
+ g_mutex_lock (&vstore->priv->sf_counts_mutex);
counts = GPOINTER_TO_INT (g_hash_table_lookup (vstore->priv->subfolder_usage_counts, subfolder));
g_return_if_fail (counts > 0);
if (camel_vee_store_get_unmatched_enabled (vstore))
camel_vee_folder_remove_folder (vstore->priv->unmatched_folder, subfolder, NULL);
- g_mutex_lock (vstore->priv->vu_counts_mutex);
+ g_mutex_lock (&vstore->priv->vu_counts_mutex);
camel_vee_data_cache_foreach_message_info_data (vstore->priv->vee_data_cache, subfolder,
remove_vuid_count_record_cb, vstore->priv->vuid_usage_counts);
- g_mutex_unlock (vstore->priv->vu_counts_mutex);
+ g_mutex_unlock (&vstore->priv->vu_counts_mutex);
camel_vee_data_cache_remove_subfolder (vstore->priv->vee_data_cache, subfolder);
} else {
subfolder, GINT_TO_POINTER (counts));
}
- g_mutex_unlock (vstore->priv->sf_counts_mutex);
+ g_mutex_unlock (&vstore->priv->sf_counts_mutex);
}
/**
if (CAMEL_IS_VEE_FOLDER (subfolder))
return;
- g_mutex_lock (vstore->priv->vu_counts_mutex);
+ g_mutex_lock (&vstore->priv->vu_counts_mutex);
vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
camel_folder_change_info_free (changes);
}
- g_mutex_unlock (vstore->priv->vu_counts_mutex);
+ g_mutex_unlock (&vstore->priv->vu_counts_mutex);
}
/**
if (CAMEL_IS_VEE_FOLDER (subfolder))
return;
- g_mutex_lock (vstore->priv->vu_counts_mutex);
+ g_mutex_lock (&vstore->priv->vu_counts_mutex);
vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
counts = GPOINTER_TO_INT (g_hash_table_lookup (vstore->priv->vuid_usage_counts, vuid));
counts--;
if (counts < 0) {
- g_mutex_unlock (vstore->priv->vu_counts_mutex);
+ g_mutex_unlock (&vstore->priv->vu_counts_mutex);
g_return_if_fail (counts >= 0);
return;
}
camel_folder_change_info_free (changes);
}
- g_mutex_unlock (vstore->priv->vu_counts_mutex);
+ g_mutex_unlock (&vstore->priv->vu_counts_mutex);
}
struct RebuildUnmatchedData {
va_list ap;
gchar *cmd;
- g_static_rec_mutex_lock (&store->command_and_response_lock);
+ g_rec_mutex_lock (&store->command_and_response_lock);
if (fmt) {
va_start (ap, fmt);
if (!imap_command_start (store, folder, cmd, cancellable, error)) {
g_free (cmd);
- g_static_rec_mutex_unlock (&store->command_and_response_lock);
+ g_rec_mutex_unlock (&store->command_and_response_lock);
return NULL;
}
g_free (cmd);
cmd = imap_command_strdup_vprintf (store, fmt, ap);
va_end (ap);
- g_static_rec_mutex_lock (&store->command_and_response_lock);
+ g_rec_mutex_lock (&store->command_and_response_lock);
ok = imap_command_start (store, folder, cmd, cancellable, error);
g_free (cmd);
if (!ok)
- g_static_rec_mutex_unlock (&store->command_and_response_lock);
+ g_rec_mutex_unlock (&store->command_and_response_lock);
return ok;
}
* the cancellable cancelled, thus there will be no I/O */
camel_service_disconnect_sync (
CAMEL_SERVICE (store), FALSE, NULL, NULL);
- g_static_rec_mutex_unlock (&store->command_and_response_lock);
+ g_rec_mutex_unlock (&store->command_and_response_lock);
return NULL;
}
g_object_unref (settings);
if (camel_imap_store_readline (store, &respbuf, cancellable, error) < 0) {
- g_static_rec_mutex_unlock (&store->command_and_response_lock);
+ g_rec_mutex_unlock (&store->command_and_response_lock);
type = CAMEL_IMAP_RESPONSE_ERROR;
goto exit;
}
if (type == CAMEL_IMAP_RESPONSE_ERROR ||
type == CAMEL_IMAP_RESPONSE_TAGGED)
- g_static_rec_mutex_unlock (&store->command_and_response_lock);
+ g_rec_mutex_unlock (&store->command_and_response_lock);
exit:
g_free (host);
* we're still locked. This lock is owned by response
* and gets unlocked when response is freed.
*/
- g_static_rec_mutex_lock (&store->command_and_response_lock);
+ g_rec_mutex_lock (&store->command_and_response_lock);
response = g_new0 (CamelImapResponse, 1);
/*FIXME if (store->current_folder && camel_disco_store_status (CAMEL_DISCO_STORE (store)) != CAMEL_DISCO_STORE_RESYNCING) {
}
g_free (response);
- g_static_rec_mutex_unlock (&store->command_and_response_lock);
+ g_rec_mutex_unlock (&store->command_and_response_lock);
}
/**
imap_folder = CAMEL_IMAP_FOLDER (object);
- g_static_mutex_free (&imap_folder->priv->search_lock);
- g_static_rec_mutex_free (&imap_folder->priv->cache_lock);
+ g_mutex_clear (&imap_folder->priv->search_lock);
+ g_rec_mutex_clear (&imap_folder->priv->cache_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_imap_folder_parent_class)->finalize (object);
folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
- g_static_mutex_init (&imap_folder->priv->search_lock);
- g_static_rec_mutex_init (&imap_folder->priv->cache_lock);
+ g_mutex_init (&imap_folder->priv->search_lock);
+ g_rec_mutex_init (&imap_folder->priv->cache_lock);
imap_folder->priv->ignore_recent = NULL;
imap_folder->journal = NULL;
G_BEGIN_DECLS
struct _CamelImapFolderPrivate {
- GStaticMutex search_lock; /* for locking the search object */
- GStaticRecMutex cache_lock; /* for locking the cache object */
+ GMutex search_lock; /* for locking the search object */
+ GRecMutex cache_lock; /* for locking the cache object */
GHashTable *ignore_recent; /* hash table of UIDs to ignore as recent when updating folder */
gboolean check_folder; /* persistent property */
gboolean apply_filters; /* persistent property */
};
#define CAMEL_IMAP_FOLDER_LOCK(f, l) \
- (g_static_mutex_lock (&((CamelImapFolder *) f)->priv->l))
+ (g_mutex_lock (&((CamelImapFolder *) f)->priv->l))
#define CAMEL_IMAP_FOLDER_UNLOCK(f, l) \
- (g_static_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
+ (g_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
#define CAMEL_IMAP_FOLDER_REC_LOCK(f, l) \
- (g_static_rec_mutex_lock (&((CamelImapFolder *) f)->priv->l))
+ (g_rec_mutex_lock (&((CamelImapFolder *) f)->priv->l))
#define CAMEL_IMAP_FOLDER_REC_UNLOCK(f, l) \
- (g_static_rec_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
+ (g_rec_mutex_unlock (&((CamelImapFolder *) f)->priv->l))
struct _CamelImapWrapperPrivate {
- GMutex *lock;
+ GMutex lock;
};
#define CAMEL_IMAP_WRAPPER_LOCK(f, l) \
- (g_mutex_lock (((CamelImapWrapper *) f)->priv->l))
+ (g_mutex_lock (&((CamelImapWrapper *) f)->priv->l))
#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) \
- (g_mutex_unlock (((CamelImapWrapper *) f)->priv->l))
+ (g_mutex_unlock (&((CamelImapWrapper *) f)->priv->l))
G_END_DECLS
((obj), CAMEL_TYPE_IMAP_SETTINGS, CamelImapSettingsPrivate))
struct _CamelImapSettingsPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *namespace;
gchar *shell_command;
gchar *real_junk_path;
priv = CAMEL_IMAP_SETTINGS_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->namespace);
g_free (priv->shell_command);
camel_imap_settings_init (CamelImapSettings *settings)
{
settings->priv = CAMEL_IMAP_SETTINGS_GET_PRIVATE (settings);
- settings->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&settings->priv->property_lock);
/* The default namespace is an empty string. */
settings->priv->namespace = g_strdup ("");
g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imap_settings_get_fetch_headers_extra (settings);
duplicate = g_strdupv ((gchar **) protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (CAMEL_IS_IMAP_SETTINGS (settings));
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (fetch_headers_equal (
(const gchar * const *) settings->priv->fetch_headers_extra,
fetch_headers_extra)) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
settings->priv->fetch_headers_extra =
g_strdupv ((gchar **) fetch_headers_extra);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "fetch-headers-extra");
}
g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imap_settings_get_namespace (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (namespace == NULL)
namespace = "";
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->namespace, namespace) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->namespace);
settings->priv->namespace = g_strdup (namespace);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "namespace");
}
g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imap_settings_get_real_junk_path (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (real_junk_path != NULL && *real_junk_path == '\0')
real_junk_path = NULL;
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->real_junk_path, real_junk_path) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->real_junk_path);
settings->priv->real_junk_path = g_strdup (real_junk_path);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "real-junk-path");
}
g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imap_settings_get_real_trash_path (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (real_trash_path != NULL && *real_trash_path == '\0')
real_trash_path = NULL;
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->real_trash_path, real_trash_path) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->real_trash_path);
settings->priv->real_trash_path = g_strdup (real_trash_path);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "real-trash-path");
}
g_return_val_if_fail (CAMEL_IS_IMAP_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_imap_settings_get_shell_command (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (shell_command != NULL && *shell_command == '\0')
shell_command = NULL;
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->shell_command, shell_command) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->shell_command);
settings->priv->shell_command = g_strdup (shell_command);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "shell-command");
}
{
CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
- g_static_rec_mutex_free (&imap_store->command_and_response_lock);
+ g_rec_mutex_clear (&imap_store->command_and_response_lock);
g_hash_table_destroy (imap_store->known_alerts);
/* Chain up to parent's finalize() method. */
static void
camel_imap_store_init (CamelImapStore *imap_store)
{
- g_static_rec_mutex_init (&imap_store->command_and_response_lock);
+ g_rec_mutex_init (&imap_store->command_and_response_lock);
imap_store->istream = NULL;
imap_store->ostream = NULL;
CamelImapStorePrivate *priv;
/* For processing IMAP commands and responses. */
- GStaticRecMutex command_and_response_lock;
+ GRecMutex command_and_response_lock;
CamelStream *istream;
CamelStream *ostream;
((obj), CAMEL_TYPE_IMAP_WRAPPER, CamelImapWrapperPrivate))
struct _CamelImapWrapperPrivate {
- GMutex *lock;
+ GMutex lock;
};
#define CAMEL_IMAP_WRAPPER_LOCK(f, l) \
- (g_mutex_lock (((CamelImapWrapper *) f)->priv->l))
+ (g_mutex_lock (&((CamelImapWrapper *) f)->priv->l))
#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) \
- (g_mutex_unlock (((CamelImapWrapper *) f)->priv->l))
+ (g_mutex_unlock (&((CamelImapWrapper *) f)->priv->l))
G_DEFINE_TYPE (CamelImapWrapper, camel_imap_wrapper, CAMEL_TYPE_DATA_WRAPPER)
g_free (imap_wrapper->uid);
g_free (imap_wrapper->part_spec);
- g_mutex_free (imap_wrapper->priv->lock);
+ g_mutex_clear (&imap_wrapper->priv->lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_imap_wrapper_parent_class)->finalize (object);
camel_imap_wrapper_init (CamelImapWrapper *imap_wrapper)
{
imap_wrapper->priv = CAMEL_IMAP_WRAPPER_GET_PRIVATE (imap_wrapper);
- imap_wrapper->priv->lock = g_mutex_new ();
+ g_mutex_init (&imap_wrapper->priv->lock);
}
CamelDataWrapper *
camel_folder_change_info_free (local_folder->changes);
- g_mutex_free (local_folder->priv->search_lock);
+ g_mutex_clear (&local_folder->priv->search_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_local_folder_parent_class)->finalize (object);
CamelFolder *folder = CAMEL_FOLDER (local_folder);
local_folder->priv = CAMEL_LOCAL_FOLDER_GET_PRIVATE (local_folder);
- local_folder->priv->search_lock = g_mutex_new ();
+ g_mutex_init (&local_folder->priv->search_lock);
folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
G_BEGIN_DECLS
struct _CamelLocalFolderPrivate {
- GMutex *search_lock; /* for locking the search object */
+ GMutex search_lock; /* for locking the search object */
};
#define CAMEL_LOCAL_FOLDER_LOCK(f, l) \
- (g_mutex_lock (((CamelLocalFolder *) f)->priv->l))
+ (g_mutex_lock (&((CamelLocalFolder *) f)->priv->l))
#define CAMEL_LOCAL_FOLDER_UNLOCK(f, l) \
- (g_mutex_unlock (((CamelLocalFolder *) f)->priv->l))
+ (g_mutex_unlock (&((CamelLocalFolder *) f)->priv->l))
gint camel_local_frompos_sort (gpointer enc,
gint len1,
gchar *hostname;
GHashTable *load_map;
- GMutex *summary_lock;
+ GMutex summary_lock;
};
G_DEFINE_TYPE (CamelMaildirSummary, camel_maildir_summary, CAMEL_TYPE_LOCAL_SUMMARY)
priv = CAMEL_MAILDIR_SUMMARY_GET_PRIVATE (object);
g_free (priv->hostname);
- g_mutex_free (priv->summary_lock);
+ g_mutex_clear (&priv->summary_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_maildir_summary_parent_class)->finalize (object);
} else {
maildir_summary->priv->hostname = g_strdup ("localhost");
}
- maildir_summary->priv->summary_lock = g_mutex_new ();
+ g_mutex_init (&maildir_summary->priv->summary_lock);
}
/**
struct _remove_data rd = { cls, changes };
GPtrArray *known_uids;
- g_mutex_lock (((CamelMaildirSummary *) cls)->priv->summary_lock);
+ g_mutex_lock (&((CamelMaildirSummary *) cls)->priv->summary_lock);
new = g_strdup_printf ("%s/new", cls->folder_path);
cur = g_strdup_printf ("%s/cur", cls->folder_path);
g_free (cur);
g_free (new);
camel_operation_pop_message (cancellable);
- g_mutex_unlock (((CamelMaildirSummary *) cls)->priv->summary_lock);
+ g_mutex_unlock (&((CamelMaildirSummary *) cls)->priv->summary_lock);
return -1;
}
g_free (cur);
camel_folder_summary_free_array (known_uids);
- g_mutex_unlock (((CamelMaildirSummary *) cls)->priv->summary_lock);
+ g_mutex_unlock (&((CamelMaildirSummary *) cls)->priv->summary_lock);
return 0;
}
{
CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (object);
- g_mutex_free (nntp_folder->priv->search_lock);
- g_mutex_free (nntp_folder->priv->cache_lock);
+ g_mutex_clear (&nntp_folder->priv->search_lock);
+ g_mutex_clear (&nntp_folder->priv->cache_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_nntp_folder_parent_class)->finalize (object);
nntp_folder->priv = CAMEL_NNTP_FOLDER_GET_PRIVATE (nntp_folder);
nntp_folder->changes = camel_folder_change_info_new ();
- nntp_folder->priv->search_lock = g_mutex_new ();
- nntp_folder->priv->cache_lock = g_mutex_new ();
+ g_mutex_init (&nntp_folder->priv->search_lock);
+ g_mutex_init (&nntp_folder->priv->cache_lock);
}
CamelFolder *
G_BEGIN_DECLS
-#define CAMEL_NNTP_STORE_LOCK(f, l) \
- (e_mutex_lock (((CamelNNTPStore *) f)->priv->l))
-#define CAMEL_NNTP_STORE_UNLOCK(f, l) \
- (e_mutex_unlock (((CamelNNTPStore *) f)->priv->l))
-
struct _CamelNNTPFolderPrivate {
- GMutex *search_lock; /* for locking the search object */
- GMutex *cache_lock; /* for locking the cache object */
+ GMutex search_lock; /* for locking the search object */
+ GMutex cache_lock; /* for locking the cache object */
gboolean apply_filters; /* persistent property */
};
#define CAMEL_NNTP_FOLDER_LOCK(f, l) \
- (g_mutex_lock (((CamelNNTPFolder *) f)->priv->l))
+ (g_mutex_lock (&((CamelNNTPFolder *) f)->priv->l))
#define CAMEL_NNTP_FOLDER_UNLOCK(f, l) \
- (g_mutex_unlock (((CamelNNTPFolder *) f)->priv->l))
+ (g_mutex_unlock (&((CamelNNTPFolder *) f)->priv->l))
G_END_DECLS
((obj), CAMEL_TYPE_SENDMAIL_SETTINGS, CamelSendmailSettingsPrivate))
struct _CamelSendmailSettingsPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *custom_binary;
gchar *custom_args;
priv = CAMEL_SENDMAIL_SETTINGS_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->custom_binary);
g_free (priv->custom_args);
camel_sendmail_settings_init (CamelSendmailSettings *settings)
{
settings->priv = CAMEL_SENDMAIL_SETTINGS_GET_PRIVATE (settings);
- settings->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&settings->priv->property_lock);
}
/**
g_return_val_if_fail (CAMEL_IS_SENDMAIL_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_sendmail_settings_get_custom_binary (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (custom_binary && !*custom_binary)
custom_binary = NULL;
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->custom_binary, custom_binary) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->custom_binary);
settings->priv->custom_binary = g_strdup (custom_binary);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "custom-binary");
}
g_return_val_if_fail (CAMEL_IS_SENDMAIL_SETTINGS (settings), NULL);
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
protected = camel_sendmail_settings_get_custom_args (settings);
duplicate = g_strdup (protected);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return duplicate;
}
if (custom_args && !*custom_args)
custom_args = NULL;
- g_mutex_lock (settings->priv->property_lock);
+ g_mutex_lock (&settings->priv->property_lock);
if (g_strcmp0 (settings->priv->custom_args, custom_args) == 0) {
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
return;
}
g_free (settings->priv->custom_args);
settings->priv->custom_args = g_strdup (custom_args);
- g_mutex_unlock (settings->priv->property_lock);
+ g_mutex_unlock (&settings->priv->property_lock);
g_object_notify (G_OBJECT (settings), "custom-args");
}
for (i = 0; i < MAX_THREADS; i++) {
GError *error = NULL;
- threads[i] = g_thread_create (worker, NULL, TRUE, &error);
- if (error) {
- fprintf (stderr, "%s: Failed to create a thread: %s\n", G_STRFUNC, error->message);
- g_error_free (error);
- }
+ threads[i] = g_thread_new (NULL, worker, NULL);
}
for (i = 0; i < MAX_THREADS; i++) {
info->id = i * MAX_MESSAGES;
info->folder = folder;
- threads[i] = g_thread_create (worker, info, TRUE, &error);
- if (error) {
- fprintf (stderr, "%s: Failed to create a thread: %s\n", G_STRFUNC, error->message);
- g_error_free (error);
- }
+ threads[i] = g_thread_new (NULL, worker, info);
}
for (i = 0; i < MAX_THREADS; i++) {
/* well i dunno, doesn't seem to be in the headers but hte manpage mentions it */
/* a nonportable checking mutex for glibc, not really needed, just validates
* the test harness really */
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define CAMEL_TEST_LOCK g_static_mutex_lock(&lock)
-#define CAMEL_TEST_UNLOCK g_static_mutex_unlock(&lock)
+static GMutex lock;
+#define CAMEL_TEST_LOCK g_mutex_lock(&lock)
+#define CAMEL_TEST_UNLOCK g_mutex_unlock(&lock)
#define CAMEL_TEST_ID (g_thread_self())
static gint setup;
dnl ******************************
dnl Libtool versioning
dnl ******************************
-LIBEDATASERVER_CURRENT=17
+LIBEDATASERVER_CURRENT=18
LIBEDATASERVER_REVISION=0
LIBEDATASERVER_AGE=0
LIBEBOOK_REVISION=1
LIBEBOOK_AGE=3
-LIBCAMEL_CURRENT=41
+LIBCAMEL_CURRENT=42
LIBCAMEL_REVISION=0
LIBCAMEL_AGE=0
dnl -Wstrict-aliasing=2
AM_CPPFLAGS="$WARNING_FLAGS -fno-strict-aliasing"
+
+dnl Be strict when compiling with .git subdirectory
+if test -d .git ; then
+ AM_CPPFLAGS="$AM_CPPFLAGS -DG_DISABLE_DEPRECATED"
+fi
+
AC_SUBST(AM_CPPFLAGS)
dnl ******************************
ThreadClosure *thread_closure;
- GMutex *shared_data_lock;
+ GMutex shared_data_lock;
GQueue try_password_queue;
GQueue wait_for_client_queue;
GWeakRef mediator;
GMainContext *main_context;
GMainLoop *main_loop;
- GCond *main_loop_cond;
- GMutex *main_loop_mutex;
+ GCond main_loop_cond;
+ GMutex main_loop_mutex;
GError *export_error;
};
* we wait for the main loop to start running as a way of
* synchronizing with the manager thread. */
closure->main_loop = g_main_loop_new (closure->main_context, FALSE);
- closure->main_loop_cond = g_cond_new ();
- closure->main_loop_mutex = g_mutex_new ();
+ g_cond_init (&closure->main_loop_cond);
+ g_mutex_init (&closure->main_loop_mutex);
return closure;
}
g_weak_ref_set (&closure->mediator, NULL);
g_main_context_unref (closure->main_context);
g_main_loop_unref (closure->main_loop);
- g_cond_free (closure->main_loop_cond);
- g_mutex_free (closure->main_loop_mutex);
+ g_cond_clear (&closure->main_loop_cond);
+ g_mutex_clear (&closure->main_loop_mutex);
g_slice_free (ThreadClosure, closure);
}
mediator = E_AUTHENTICATION_MEDIATOR (user_data);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
mediator->priv->client_vanished = TRUE;
g_bus_unwatch_name (mediator->priv->watcher_id);
mediator->priv->watcher_id = 0;
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
}
static void
mediator = g_weak_ref_get (&closure->mediator);
g_return_val_if_fail (mediator != NULL, FALSE);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
mediator->priv->client_is_ready = TRUE;
g_object_unref (simple);
}
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
e_dbus_authenticator_complete_ready (interface, invocation);
mediator = g_weak_ref_get (&closure->mediator);
g_return_val_if_fail (mediator != NULL, FALSE);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
mediator->priv->client_cancelled = TRUE;
g_object_unref (simple);
}
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
e_dbus_authenticator_complete_cancel (interface, invocation);
mediator = g_weak_ref_get (&closure->mediator);
g_return_val_if_fail (mediator != NULL, FALSE);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
queue = &mediator->priv->try_password_queue;
g_object_unref (simple);
}
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
e_dbus_authenticator_complete_accepted (interface, invocation);
mediator = g_weak_ref_get (&closure->mediator);
g_return_val_if_fail (mediator != NULL, FALSE);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
queue = &mediator->priv->try_password_queue;
g_object_unref (simple);
}
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
e_dbus_authenticator_complete_rejected (interface, invocation);
{
ThreadClosure *closure = data;
- g_mutex_lock (closure->main_loop_mutex);
- g_cond_broadcast (closure->main_loop_cond);
- g_mutex_unlock (closure->main_loop_mutex);
+ g_mutex_lock (&closure->main_loop_mutex);
+ g_cond_broadcast (&closure->main_loop_cond);
+ g_mutex_unlock (&closure->main_loop_mutex);
return FALSE;
}
priv = E_AUTHENTICATION_MEDIATOR_GET_PRIVATE (object);
- g_mutex_free (priv->shared_data_lock);
+ g_mutex_clear (&priv->shared_data_lock);
g_free (priv->object_path);
g_free (priv->sender);
* main loop will signal the thread itself to terminate. */
mediator->priv->thread_closure = thread_closure_ref (closure);
- thread = g_thread_create (
+ thread = g_thread_new (NULL,
authentication_mediator_authenticator_thread,
- closure, FALSE /* joinable */, error);
+ closure);
if (thread == NULL) {
thread_closure_unref (closure);
return FALSE;
}
+ g_thread_unref (thread);
+
/* Wait for notification that the Authenticator interface
* has been exported and the thread's main loop started. */
- g_mutex_lock (closure->main_loop_mutex);
+ g_mutex_lock (&closure->main_loop_mutex);
while (!g_main_loop_is_running (closure->main_loop))
g_cond_wait (
- closure->main_loop_cond,
- closure->main_loop_mutex);
- g_mutex_unlock (closure->main_loop_mutex);
+ &closure->main_loop_cond,
+ &closure->main_loop_mutex);
+ g_mutex_unlock (&closure->main_loop_mutex);
/* Check whether the interface failed to export. */
if (closure->export_error != NULL) {
mediator = E_AUTHENTICATION_MEDIATOR (auth);
async_context = g_slice_new0 (AsyncContext);
- async_context->shared_data_lock = mediator->priv->shared_data_lock;
+ async_context->shared_data_lock = &mediator->priv->shared_data_lock;
async_context->operation_queue = &mediator->priv->try_password_queue;
simple = g_simple_async_result_new (
INACTIVITY_TIMEOUT,
authentication_mediator_timeout_cb, simple);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
if (mediator->priv->client_cancelled) {
g_simple_async_result_set_error (
g_free (encrypted_secret);
}
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
g_object_unref (simple);
}
mediator->priv->interface = e_dbus_authenticator_skeleton_new ();
mediator->priv->secret_exchange = gcr_secret_exchange_new (NULL);
- mediator->priv->shared_data_lock = g_mutex_new ();
+ g_mutex_init (&mediator->priv->shared_data_lock);
}
/**
g_return_if_fail (E_IS_AUTHENTICATION_MEDIATOR (mediator));
async_context = g_slice_new0 (AsyncContext);
- async_context->shared_data_lock = mediator->priv->shared_data_lock;
+ async_context->shared_data_lock = &mediator->priv->shared_data_lock;
async_context->operation_queue = &mediator->priv->wait_for_client_queue;
simple = g_simple_async_result_new (
async_context->timeout_id = g_timeout_add_seconds (
INACTIVITY_TIMEOUT, authentication_mediator_timeout_cb, simple);
- g_mutex_lock (mediator->priv->shared_data_lock);
+ g_mutex_lock (&mediator->priv->shared_data_lock);
if (mediator->priv->client_is_ready) {
g_simple_async_result_complete_in_idle (simple);
g_object_ref (simple));
}
- g_mutex_unlock (mediator->priv->shared_data_lock);
+ g_mutex_unlock (&mediator->priv->shared_data_lock);
g_object_unref (simple);
}
gchar *source_uid;
/* These are for configuring system prompts. */
- GMutex *property_lock;
+ GMutex property_lock;
gchar *prompt_title;
gchar *prompt_message;
gchar *prompt_description;
priv = E_AUTHENTICATION_SESSION_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->source_uid);
g_free (priv->prompt_title);
e_authentication_session_init (EAuthenticationSession *session)
{
session->priv = E_AUTHENTICATION_SESSION_GET_PRIVATE (session);
- session->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&session->priv->property_lock);
}
GQuark
g_return_val_if_fail (E_IS_AUTHENTICATION_SESSION (session), NULL);
- g_mutex_lock (session->priv->property_lock);
+ g_mutex_lock (&session->priv->property_lock);
protected = e_authentication_session_get_prompt_title (session);
duplicate = g_strdup (protected);
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
- g_mutex_lock (session->priv->property_lock);
+ g_mutex_lock (&session->priv->property_lock);
if (g_strcmp0 (session->priv->prompt_title, prompt_title) == 0) {
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
return;
}
g_free (session->priv->prompt_title);
session->priv->prompt_title = g_strdup (prompt_title);
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
g_object_notify (G_OBJECT (session), "prompt-title");
}
g_return_val_if_fail (E_IS_AUTHENTICATION_SESSION (session), NULL);
- g_mutex_lock (session->priv->property_lock);
+ g_mutex_lock (&session->priv->property_lock);
protected = e_authentication_session_get_prompt_message (session);
duplicate = g_strdup (protected);
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
- g_mutex_lock (session->priv->property_lock);
+ g_mutex_lock (&session->priv->property_lock);
if (g_strcmp0 (session->priv->prompt_message, prompt_message) == 0) {
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
return;
}
g_free (session->priv->prompt_message);
session->priv->prompt_message = g_strdup (prompt_message);
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
g_object_notify (G_OBJECT (session), "prompt-message");
}
g_return_val_if_fail (E_IS_AUTHENTICATION_SESSION (session), NULL);
- g_mutex_lock (session->priv->property_lock);
+ g_mutex_lock (&session->priv->property_lock);
protected = e_authentication_session_get_prompt_description (session);
duplicate = g_strdup (protected);
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
- g_mutex_lock (session->priv->property_lock);
+ g_mutex_lock (&session->priv->property_lock);
if (g_strcmp0 (session->priv->prompt_description, prompt_description) == 0) {
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
return;
}
g_free (session->priv->prompt_description);
session->priv->prompt_description = g_strdup (prompt_description);
- g_mutex_unlock (session->priv->property_lock);
+ g_mutex_unlock (&session->priv->property_lock);
g_object_notify (G_OBJECT (session), "prompt-description");
}
/* Set of ESources */
GHashTable *children;
- GMutex *children_lock;
+ GMutex children_lock;
gchar *cache_dir;
/* Resource ID -> ESource */
GHashTable *unclaimed_resources;
- GMutex *unclaimed_resources_lock;
+ GMutex unclaimed_resources_lock;
gulong source_added_handler_id;
gulong source_removed_handler_id;
collection_backend_children_insert (ECollectionBackend *backend,
ESource *source)
{
- g_mutex_lock (backend->priv->children_lock);
+ g_mutex_lock (&backend->priv->children_lock);
g_hash_table_add (backend->priv->children, g_object_ref (source));
- g_mutex_unlock (backend->priv->children_lock);
+ g_mutex_unlock (&backend->priv->children_lock);
}
static gboolean
{
gboolean removed;
- g_mutex_lock (backend->priv->children_lock);
+ g_mutex_lock (&backend->priv->children_lock);
removed = g_hash_table_remove (backend->priv->children, source);
- g_mutex_unlock (backend->priv->children_lock);
+ g_mutex_unlock (&backend->priv->children_lock);
return removed;
}
{
GList *list, *link;
- g_mutex_lock (backend->priv->children_lock);
+ g_mutex_lock (&backend->priv->children_lock);
list = g_hash_table_get_keys (backend->priv->children);
for (link = list; link != NULL; link = g_list_next (link))
g_object_ref (link->data);
- g_mutex_unlock (backend->priv->children_lock);
+ g_mutex_unlock (&backend->priv->children_lock);
return list;
}
file = g_file_new_for_path (cache_dir);
server = e_collection_backend_ref_server (backend);
- g_mutex_lock (backend->priv->unclaimed_resources_lock);
+ g_mutex_lock (&backend->priv->unclaimed_resources_lock);
while ((name = g_dir_read_name (dir)) != NULL) {
GFile *child;
g_object_unref (source);
}
- g_mutex_unlock (backend->priv->unclaimed_resources_lock);
+ g_mutex_unlock (&backend->priv->unclaimed_resources_lock);
g_object_unref (file);
g_object_unref (server);
GHashTable *unclaimed_resources;
ESource *source;
- g_mutex_lock (backend->priv->unclaimed_resources_lock);
+ g_mutex_lock (&backend->priv->unclaimed_resources_lock);
unclaimed_resources = backend->priv->unclaimed_resources;
source = g_hash_table_lookup (unclaimed_resources, resource_id);
g_object_unref (file);
}
- g_mutex_unlock (backend->priv->unclaimed_resources_lock);
+ g_mutex_unlock (&backend->priv->unclaimed_resources_lock);
return source;
}
g_object_unref (server);
}
- g_mutex_lock (priv->children_lock);
+ g_mutex_lock (&priv->children_lock);
g_hash_table_remove_all (priv->children);
- g_mutex_unlock (priv->children_lock);
+ g_mutex_unlock (&priv->children_lock);
- g_mutex_lock (priv->unclaimed_resources_lock);
+ g_mutex_lock (&priv->unclaimed_resources_lock);
g_hash_table_remove_all (priv->unclaimed_resources);
- g_mutex_unlock (priv->unclaimed_resources_lock);
+ g_mutex_unlock (&priv->unclaimed_resources_lock);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_collection_backend_parent_class)->dispose (object);
priv = E_COLLECTION_BACKEND_GET_PRIVATE (object);
g_hash_table_destroy (priv->children);
- g_mutex_free (priv->children_lock);
+ g_mutex_clear (&priv->children_lock);
g_hash_table_destroy (priv->unclaimed_resources);
- g_mutex_free (priv->unclaimed_resources_lock);
+ g_mutex_clear (&priv->unclaimed_resources_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_collection_backend_parent_class)->finalize (object);
backend->priv = E_COLLECTION_BACKEND_GET_PRIVATE (backend);
backend->priv->children = children;
- backend->priv->children_lock = g_mutex_new ();
+ g_mutex_init (&backend->priv->children_lock);
backend->priv->unclaimed_resources = unclaimed_resources;
- backend->priv->unclaimed_resources_lock = g_mutex_new ();
+ g_mutex_init (&backend->priv->unclaimed_resources_lock);
}
/**
g_return_val_if_fail (E_IS_COLLECTION_BACKEND (backend), NULL);
- g_mutex_lock (backend->priv->unclaimed_resources_lock);
+ g_mutex_lock (&backend->priv->unclaimed_resources_lock);
unclaimed_resources = backend->priv->unclaimed_resources;
resources = g_hash_table_get_values (unclaimed_resources);
g_list_foreach (resources, (GFunc) g_object_ref, NULL);
g_hash_table_remove_all (unclaimed_resources);
- g_mutex_unlock (backend->priv->unclaimed_resources_lock);
+ g_mutex_unlock (&backend->priv->unclaimed_resources_lock);
return resources;
}
* 'backend_factories' hash table doesn't really need
* guarding since it gets populated during construction
* and is read-only thereafter. */
- GMutex *mutex;
+ GMutex mutex;
/* ESource UID -> GWeakRef (EBackend) */
GHashTable *backends;
priv = E_DATA_FACTORY_GET_PRIVATE (object);
- g_mutex_free (priv->mutex);
+ g_mutex_clear (&priv->mutex);
g_hash_table_destroy (priv->backends);
g_hash_table_destroy (priv->backend_factories);
{
data_factory->priv = E_DATA_FACTORY_GET_PRIVATE (data_factory);
- data_factory->priv->mutex = g_mutex_new ();
+ g_mutex_init (&data_factory->priv->mutex);
data_factory->priv->backends = g_hash_table_new_full (
(GHashFunc) g_str_hash,
uid = e_source_get_uid (source);
g_return_val_if_fail (uid != NULL, NULL);
- g_mutex_lock (data_factory->priv->mutex);
+ g_mutex_lock (&data_factory->priv->mutex);
/* The weak ref is already inserted in the hash table. */
weak_ref = data_factory_backends_lookup (data_factory, uid);
g_object_unref (backend_factory);
exit:
- g_mutex_unlock (data_factory->priv->mutex);
+ g_mutex_unlock (&data_factory->priv->mutex);
return backend;
}
GHashTable *orphans; /* sources waiting for parent */
GHashTable *monitors;
- GMutex *sources_lock;
- GMutex *orphans_lock;
+ GMutex sources_lock;
+ GMutex orphans_lock;
/* In pseudo-Python notation:
*
* the user decides not to cache the secret at all, in which case
* he gets what he asked for: lots of annoying prompts.
*/
- GMutex *auth_lock;
+ GMutex auth_lock;
GHashTable *running_auths;
GHashTable *waiting_auths;
uid = e_source_get_uid (source);
g_return_if_fail (uid != NULL);
- g_mutex_lock (server->priv->sources_lock);
+ g_mutex_lock (&server->priv->sources_lock);
g_hash_table_insert (
server->priv->sources,
g_strdup (uid), g_object_ref (source));
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
}
static gboolean
uid = e_source_get_uid (source);
g_return_val_if_fail (uid != NULL, FALSE);
- g_mutex_lock (server->priv->sources_lock);
+ g_mutex_lock (&server->priv->sources_lock);
removed = g_hash_table_remove (server->priv->sources, uid);
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
return removed;
}
g_return_val_if_fail (uid != NULL, NULL);
- g_mutex_lock (server->priv->sources_lock);
+ g_mutex_lock (&server->priv->sources_lock);
source = g_hash_table_lookup (server->priv->sources, uid);
if (source != NULL)
g_object_ref (source);
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
return source;
}
{
GList *values;
- g_mutex_lock (server->priv->sources_lock);
+ g_mutex_lock (&server->priv->sources_lock);
values = g_hash_table_get_values (server->priv->sources);
g_list_foreach (values, (GFunc) g_object_ref, NULL);
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
return values;
}
GPtrArray *array;
gchar *parent_uid;
- g_mutex_lock (server->priv->orphans_lock);
+ g_mutex_lock (&server->priv->orphans_lock);
orphans = server->priv->orphans;
g_free (parent_uid);
- g_mutex_unlock (server->priv->orphans_lock);
+ g_mutex_unlock (&server->priv->orphans_lock);
}
static gboolean
gchar *parent_uid;
gboolean removed = FALSE;
- g_mutex_lock (server->priv->orphans_lock);
+ g_mutex_lock (&server->priv->orphans_lock);
orphans = server->priv->orphans;
g_free (parent_uid);
- g_mutex_unlock (server->priv->orphans_lock);
+ g_mutex_unlock (&server->priv->orphans_lock);
return removed;
}
parent_uid = e_source_get_uid (parent_source);
g_return_val_if_fail (parent_uid != NULL, NULL);
- g_mutex_lock (server->priv->orphans_lock);
+ g_mutex_lock (&server->priv->orphans_lock);
orphans = server->priv->orphans;
g_hash_table_remove (orphans, parent_uid);
}
- g_mutex_unlock (server->priv->orphans_lock);
+ g_mutex_unlock (&server->priv->orphans_lock);
return array;
}
GHashTableIter iter;
gpointer value;
- g_mutex_lock (server->priv->auth_lock);
+ g_mutex_lock (&server->priv->auth_lock);
g_hash_table_iter_init (&iter, server->priv->waiting_auths);
g_cancellable_cancel (request->cancellable);
}
- g_mutex_unlock (server->priv->auth_lock);
+ g_mutex_unlock (&server->priv->auth_lock);
}
static void
g_return_if_fail (uid != NULL);
- g_mutex_lock (server->priv->auth_lock);
+ g_mutex_lock (&server->priv->auth_lock);
queue = g_hash_table_lookup (server->priv->waiting_auths, uid);
g_queue_push_tail (queue, auth_request_ref (request));
- g_mutex_unlock (server->priv->auth_lock);
+ g_mutex_unlock (&server->priv->auth_lock);
}
static AuthRequest *
g_return_val_if_fail (uid != NULL, NULL);
- g_mutex_lock (server->priv->auth_lock);
+ g_mutex_lock (&server->priv->auth_lock);
/* If we're already busy processing an authentication request
* for this UID, the next request will have to wait in line. */
auth_request_ref (request));
}
- g_mutex_unlock (server->priv->auth_lock);
+ g_mutex_unlock (&server->priv->auth_lock);
return request;
}
{
g_return_if_fail (uid != NULL);
- g_mutex_lock (server->priv->auth_lock);
+ g_mutex_lock (&server->priv->auth_lock);
g_hash_table_remove (server->priv->running_auths, uid);
- g_mutex_unlock (server->priv->auth_lock);
+ g_mutex_unlock (&server->priv->auth_lock);
}
static void
g_hash_table_destroy (priv->orphans);
g_hash_table_destroy (priv->monitors);
- g_mutex_free (priv->sources_lock);
- g_mutex_free (priv->orphans_lock);
+ g_mutex_clear (&priv->sources_lock);
+ g_mutex_clear (&priv->orphans_lock);
- g_mutex_free (priv->auth_lock);
+ g_mutex_clear (&priv->auth_lock);
g_hash_table_destroy (priv->running_auths);
g_hash_table_destroy (priv->waiting_auths);
server->priv->sources = sources;
server->priv->orphans = orphans;
server->priv->monitors = monitors;
- server->priv->sources_lock = g_mutex_new ();
- server->priv->orphans_lock = g_mutex_new ();
- server->priv->auth_lock = g_mutex_new ();
+ g_mutex_init (&server->priv->sources_lock);
+ g_mutex_init (&server->priv->orphans_lock);
+ g_mutex_init (&server->priv->auth_lock);
server->priv->waiting_auths = waiting_auths;
server->priv->running_auths = running_auths;
uid = e_source_get_uid (source);
g_return_if_fail (uid != NULL);
- g_mutex_lock (server->priv->sources_lock);
+ g_mutex_lock (&server->priv->sources_lock);
/* Check if we already have this object in the hierarchy. */
if (g_hash_table_lookup (server->priv->sources, uid) != NULL) {
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
return;
}
/* Make sure the parent object (if any) is in the hierarchy. */
if (!source_registry_server_find_parent (server, source)) {
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
return;
}
- g_mutex_unlock (server->priv->sources_lock);
+ g_mutex_unlock (&server->priv->sources_lock);
/* Before we emit, make sure the EDBusSource's "data" property
* is up-to-date. ESource changes get propagated to the "data"
typedef struct {
sqlite3_file parent;
sqlite3_file *old_vfs_file; /* pointer to old_vfs' file */
- GStaticRecMutex sync_mutex;
+ GRecMutex sync_mutex;
guint timeout_id;
gint flags;
} ESqlite3File;
g_return_if_fail (cFile != NULL);
g_return_if_fail (sync_pool != NULL);
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
if (wait_for_finish)
sync_op = e_flag_new ();
cFile->flags = 0;
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
g_thread_pool_push (sync_pool, data, &error);
static gboolean
sync_push_request_timeout (ESqlite3File *cFile)
{
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
if (cFile->timeout_id != 0) {
sync_push_request (cFile, FALSE);
cFile->timeout_id = 0;
}
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
return FALSE;
}
cFile = (ESqlite3File *) pFile;
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
/* Cancel any pending sync requests. */
if (cFile->timeout_id > 0) {
cFile->timeout_id = 0;
}
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
/* Make the last sync. */
sync_push_request (cFile, TRUE);
g_free (cFile->old_vfs_file);
cFile->old_vfs_file = NULL;
- g_static_rec_mutex_free (&cFile->sync_mutex);
+ g_rec_mutex_clear (&cFile->sync_mutex);
return res;
}
cFile = (ESqlite3File *) pFile;
- g_static_rec_mutex_lock (&cFile->sync_mutex);
+ g_rec_mutex_lock (&cFile->sync_mutex);
/* If a sync request is already scheduled, accumulate flags. */
cFile->flags |= flags;
SYNC_TIMEOUT_SECONDS, (GSourceFunc)
sync_push_request_timeout, cFile);
- g_static_rec_mutex_unlock (&cFile->sync_mutex);
+ g_rec_mutex_unlock (&cFile->sync_mutex);
return SQLITE_OK;
}
gint flags,
gint *pOutFlags)
{
- static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT;
+ static GRecMutex only_once_lock;
static sqlite3_io_methods io_methods = {0};
ESqlite3File *cFile;
gint res;
return res;
}
- g_static_rec_mutex_init (&cFile->sync_mutex);
+ g_rec_mutex_init (&cFile->sync_mutex);
- g_static_rec_mutex_lock (&only_once_lock);
+ g_rec_mutex_lock (&only_once_lock);
if (!sync_pool)
sync_pool = g_thread_pool_new (sync_request_thread_cb, NULL, 2, FALSE, NULL);
#undef use_subclassed
}
- g_static_rec_mutex_unlock (&only_once_lock);
+ g_rec_mutex_unlock (&only_once_lock);
cFile->parent.pMethods = &io_methods;
listeners = g_object_new (e_changed_listener_get_type (), NULL);
- g_atexit (finalize_categories);
+ atexit (finalize_categories);
n_added = load_categories ();
if (n_added > 0) {
((obj), E_TYPE_CLIENT, EClientPrivate))
struct _EClientPrivate {
- GStaticRecMutex prop_mutex;
+ GRecMutex prop_mutex;
ESource *source;
gchar *uri;
GHashTable *backend_property_cache;
- GStaticRecMutex ops_mutex;
+ GRecMutex ops_mutex;
guint32 last_opid;
GHashTable *ops; /* opid to GCancellable */
};
client->priv->readonly = TRUE;
- g_static_rec_mutex_init (&client->priv->prop_mutex);
+ g_rec_mutex_init (&client->priv->prop_mutex);
client->priv->backend_property_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- g_static_rec_mutex_init (&client->priv->ops_mutex);
+ g_rec_mutex_init (&client->priv->ops_mutex);
client->priv->last_opid = 0;
client->priv->ops = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
}
priv = client->priv;
- g_static_rec_mutex_lock (&priv->prop_mutex);
+ g_rec_mutex_lock (&priv->prop_mutex);
if (priv->source) {
g_object_unref (priv->source);
priv->ops = NULL;
}
- g_static_rec_mutex_unlock (&priv->prop_mutex);
- g_static_rec_mutex_free (&priv->prop_mutex);
- g_static_rec_mutex_free (&priv->ops_mutex);
+ g_rec_mutex_unlock (&priv->prop_mutex);
+ g_rec_mutex_clear (&priv->prop_mutex);
+ g_rec_mutex_clear (&priv->ops_mutex);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_client_parent_class)->finalize (object);
if (client->priv->capabilities_retrieved || client->priv->capabilities)
return;
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
capabilities = NULL;
e_client_retrieve_capabilities_sync (client, &capabilities, NULL, NULL);
client->priv->capabilities_retrieved = TRUE;
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
}
/**
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
g_return_val_if_fail (capability, FALSE);
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
client_ensure_capabilities (client);
const gchar *cap = iter->data;
if (cap && g_ascii_strcasecmp (cap, capability) == 0) {
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
return TRUE;
}
}
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
return FALSE;
}
{
g_return_if_fail (E_IS_CLIENT (client));
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
if (!capabilities)
client->priv->capabilities_retrieved = FALSE;
g_slist_free (client->priv->capabilities);
client->priv->capabilities = e_client_util_parse_comma_strings (capabilities);
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
g_object_notify (G_OBJECT (client), "capabilities");
}
{
g_return_if_fail (E_IS_CLIENT (client));
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
if ((readonly ? 1 : 0) == (client->priv->readonly ? 1 : 0)) {
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
return;
}
client->priv->readonly = readonly;
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
g_object_notify (G_OBJECT (client), "readonly");
}
/* newly connected/disconnected => make sure capabilities will be correct */
e_client_set_capabilities (client, NULL);
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
if ((is_online ? 1: 0) == (client->priv->online ? 1 : 0)) {
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
return;
}
client->priv->online = is_online;
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
g_object_notify (G_OBJECT (client), "online");
}
g_return_if_fail (E_IS_CLIENT (client));
g_return_if_fail (client->priv->ops != NULL);
- g_static_rec_mutex_lock (&client->priv->ops_mutex);
+ g_rec_mutex_lock (&client->priv->ops_mutex);
cancellable = g_hash_table_lookup (client->priv->ops, GINT_TO_POINTER (opid));
if (cancellable)
g_cancellable_cancel (cancellable);
- g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+ g_rec_mutex_unlock (&client->priv->ops_mutex);
}
static void
g_return_if_fail (E_IS_CLIENT (client));
g_return_if_fail (client->priv->ops != NULL);
- g_static_rec_mutex_lock (&client->priv->ops_mutex);
+ g_rec_mutex_lock (&client->priv->ops_mutex);
g_hash_table_foreach (client->priv->ops, gather_opids_cb, &opids);
g_slist_foreach (opids, cancel_op_cb, client);
g_slist_free (opids);
- g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+ g_rec_mutex_unlock (&client->priv->ops_mutex);
}
guint32
g_return_val_if_fail (client->priv->ops != NULL, 0);
g_return_val_if_fail (cancellable != NULL, 0);
- g_static_rec_mutex_lock (&client->priv->ops_mutex);
+ g_rec_mutex_lock (&client->priv->ops_mutex);
client->priv->last_opid++;
if (!client->priv->last_opid)
opid = client->priv->last_opid;
g_hash_table_insert (client->priv->ops, GINT_TO_POINTER (opid), g_object_ref (cancellable));
- g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+ g_rec_mutex_unlock (&client->priv->ops_mutex);
return opid;
}
g_return_if_fail (E_IS_CLIENT (client));
g_return_if_fail (client->priv->ops != NULL);
- g_static_rec_mutex_lock (&client->priv->ops_mutex);
+ g_rec_mutex_lock (&client->priv->ops_mutex);
g_hash_table_remove (client->priv->ops, GINT_TO_POINTER (opid));
- g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+ g_rec_mutex_unlock (&client->priv->ops_mutex);
}
void
g_return_if_fail (*prop_name);
g_return_if_fail (prop_value != NULL);
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
if (client->priv->backend_property_cache)
g_hash_table_insert (client->priv->backend_property_cache, g_strdup (prop_name), g_strdup (prop_value));
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
}
gchar *
g_return_val_if_fail (prop_name != NULL, NULL);
g_return_val_if_fail (*prop_name, NULL);
- g_static_rec_mutex_lock (&client->priv->prop_mutex);
+ g_rec_mutex_lock (&client->priv->prop_mutex);
if (client->priv->backend_property_cache)
prop_value = g_strdup (g_hash_table_lookup (client->priv->backend_property_cache, prop_name));
- g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+ g_rec_mutex_unlock (&client->priv->prop_mutex);
return prop_value;
}
case G_UNICODE_CONTROL:
case G_UNICODE_FORMAT:
case G_UNICODE_UNASSIGNED:
- case G_UNICODE_COMBINING_MARK:
+ case G_UNICODE_SPACING_MARK:
/* Ignore those */
return 0;
default:
#define KEY_FILE_DOMAINS_KEY "enable domains"
#define KEY_FILE_MAX_LINES_KEY "max lines"
-static GStaticMutex log_mutex = G_STATIC_MUTEX_INIT;
+static GMutex log_mutex;
static GHashTable *domains_hash;
static gchar **ring_buffer;
static void
lock (void)
{
- g_static_mutex_lock (&log_mutex);
+ g_mutex_lock (&log_mutex);
}
static void
unlock (void)
{
- g_static_mutex_unlock (&log_mutex);
+ g_mutex_unlock (&log_mutex);
}
/**
#include "e-flag.h"
struct _EFlag {
- GCond *cond;
- GMutex *mutex;
+ GCond cond;
+ GMutex mutex;
gboolean is_set;
};
EFlag *flag;
flag = g_slice_new (EFlag);
- flag->cond = g_cond_new ();
- flag->mutex = g_mutex_new ();
+ g_cond_init (&flag->cond);
+ g_mutex_init (&flag->mutex);
flag->is_set = FALSE;
return flag;
g_return_val_if_fail (flag != NULL, FALSE);
- g_mutex_lock (flag->mutex);
+ g_mutex_lock (&flag->mutex);
is_set = flag->is_set;
- g_mutex_unlock (flag->mutex);
+ g_mutex_unlock (&flag->mutex);
return is_set;
}
* @flag: an #EFlag
*
* Sets @flag. All threads waiting on @flag are woken up. Threads that
- * call e_flag_wait() or e_flag_timed_wait() once @flag is set will not
+ * call e_flag_wait() or e_flag_wait_until() once @flag is set will not
* block at all.
*
* Since: 1.12
{
g_return_if_fail (flag != NULL);
- g_mutex_lock (flag->mutex);
+ g_mutex_lock (&flag->mutex);
flag->is_set = TRUE;
- g_cond_broadcast (flag->cond);
- g_mutex_unlock (flag->mutex);
+ g_cond_broadcast (&flag->cond);
+ g_mutex_unlock (&flag->mutex);
}
/**
* e_flag_clear:
* @flag: an #EFlag
*
- * Unsets @flag. Subsequent calls to e_flag_wait() or e_flag_timed_wait()
+ * Unsets @flag. Subsequent calls to e_flag_wait() or e_flag_wait_until()
* will block until @flag is set.
*
* Since: 1.12
{
g_return_if_fail (flag != NULL);
- g_mutex_lock (flag->mutex);
+ g_mutex_lock (&flag->mutex);
flag->is_set = FALSE;
- g_mutex_unlock (flag->mutex);
+ g_mutex_unlock (&flag->mutex);
}
/**
{
g_return_if_fail (flag != NULL);
- g_mutex_lock (flag->mutex);
+ g_mutex_lock (&flag->mutex);
while (!flag->is_set)
- g_cond_wait (flag->cond, flag->mutex);
- g_mutex_unlock (flag->mutex);
+ g_cond_wait (&flag->cond, &flag->mutex);
+ g_mutex_unlock (&flag->mutex);
}
/**
- * e_flag_timed_wait:
+ * e_flag_wait_until:
* @flag: an #EFlag
- * @abs_time: a #GTimeVal, determining the final time
+ * @end_time: the monotonic time to wait until
*
- * Blocks until @flag is set, or until the time specified by @abs_time.
+ * Blocks until @flag is set, or until the time specified by @end_time.
* If @flag is already set, the function returns immediately. The return
* value indicates the state of @flag after waiting.
*
- * If @abs_time is %NULL, e_flag_timed_wait() acts like e_flag_wait().
- *
- * To easily calculate @abs_time, a combination of g_get_current_time() and
- * g_time_val_add() can be used.
+ * To easily calculate @end_time, a combination of g_get_monotonic_time() and
+ * G_TIME_SPAN_SECOND macro.
*
* Returns: %TRUE if @flag is now set
*
- * Since: 1.12
+ * Since: 3.8
**/
gboolean
-e_flag_timed_wait (EFlag *flag,
- GTimeVal *abs_time)
+e_flag_wait_until (EFlag *flag,
+ gint64 end_time)
{
gboolean is_set;
g_return_val_if_fail (flag != NULL, FALSE);
- g_mutex_lock (flag->mutex);
+ g_mutex_lock (&flag->mutex);
while (!flag->is_set)
- if (!g_cond_timed_wait (flag->cond, flag->mutex, abs_time))
+ if (!g_cond_wait_until (&flag->cond, &flag->mutex, end_time))
break;
is_set = flag->is_set;
- g_mutex_unlock (flag->mutex);
+ g_mutex_unlock (&flag->mutex);
return is_set;
}
{
g_return_if_fail (flag != NULL);
- g_cond_free (flag->cond);
- g_mutex_free (flag->mutex);
+ g_cond_clear (&flag->cond);
+ g_mutex_clear (&flag->mutex);
g_slice_free (EFlag, flag);
}
void e_flag_set (EFlag *flag);
void e_flag_clear (EFlag *flag);
void e_flag_wait (EFlag *flag);
-gboolean e_flag_timed_wait (EFlag *flag,
- GTimeVal *abs_time);
+gboolean e_flag_wait_until (EFlag *flag,
+ gint64 end_time);
void e_flag_free (EFlag *flag);
G_END_DECLS
struct _EOperationPool {
GThreadPool *pool;
- GMutex *ops_lock;
+ GMutex ops_lock;
GHashTable *ops;
guint32 last_opid;
};
pool = g_new0 (EOperationPool, 1);
pool->pool = thread_pool;
- pool->ops_lock = g_mutex_new ();
+ g_mutex_init (&pool->ops_lock);
pool->ops = g_hash_table_new (g_direct_hash, g_direct_equal);
pool->last_opid = 0;
g_return_if_fail (pool != NULL);
g_thread_pool_free (pool->pool, FALSE, FALSE);
- g_mutex_free (pool->ops_lock);
+ g_mutex_clear (&pool->ops_lock);
g_hash_table_destroy (pool->ops);
g_free (pool);
}
g_return_val_if_fail (pool != NULL, 0);
g_return_val_if_fail (pool->ops != NULL, 0);
- g_return_val_if_fail (pool->ops_lock != NULL, 0);
- g_mutex_lock (pool->ops_lock);
+ g_mutex_lock (&pool->ops_lock);
pool->last_opid++;
if (!pool->last_opid)
if (opid)
g_hash_table_insert (pool->ops, GUINT_TO_POINTER (opid), GUINT_TO_POINTER (1));
- g_mutex_unlock (pool->ops_lock);
+ g_mutex_unlock (&pool->ops_lock);
g_return_val_if_fail (opid != 0, 0);
{
g_return_if_fail (pool != NULL);
g_return_if_fail (pool->ops != NULL);
- g_return_if_fail (pool->ops_lock != NULL);
- g_mutex_lock (pool->ops_lock);
+ g_mutex_lock (&pool->ops_lock);
g_hash_table_remove (pool->ops, GUINT_TO_POINTER (opid));
- g_mutex_unlock (pool->ops_lock);
+ g_mutex_unlock (&pool->ops_lock);
}
/**
((obj), E_TYPE_SOURCE_ALARMS, ESourceAlarmsPrivate))
struct _ESourceAlarmsPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gboolean include_me;
gchar *last_notified;
};
priv = E_SOURCE_ALARMS_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->last_notified);
e_source_alarms_init (ESourceAlarms *extension)
{
extension->priv = E_SOURCE_ALARMS_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_ALARMS (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_alarms_get_last_notified (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
}
}
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->last_notified, last_notified) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->last_notified);
extension->priv->last_notified = g_strdup (last_notified);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "last-notified");
}
((obj), E_TYPE_SOURCE_AUTHENTICATION, ESourceAuthenticationPrivate))
struct _ESourceAuthenticationPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *host;
gchar *method;
guint16 port;
priv = E_SOURCE_AUTHENTICATION_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->host);
g_free (priv->method);
e_source_authentication_init (ESourceAuthentication *extension)
{
extension->priv = E_SOURCE_AUTHENTICATION_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_authentication_get_host (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->host, host) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->host);
extension->priv->host = e_util_strdup_strip (host);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "host");
}
g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_authentication_get_method (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->method, method) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
if (extension->priv->method == NULL)
extension->priv->method = g_strdup ("none");
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "method");
}
g_return_val_if_fail (E_IS_SOURCE_AUTHENTICATION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_authentication_get_user (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->user, user) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->user);
extension->priv->user = e_util_strdup_strip (user);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "user");
}
((obj), E_TYPE_SOURCE_BACKEND, ESourceBackendPrivate))
struct _ESourceBackendPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *backend_name;
};
priv = E_SOURCE_BACKEND_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->backend_name);
e_source_backend_init (ESourceBackend *extension)
{
extension->priv = E_SOURCE_BACKEND_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_BACKEND (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_backend_get_backend_name (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_BACKEND (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->backend_name, backend_name) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->backend_name);
extension->priv->backend_name = e_util_strdup_strip (backend_name);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "backend-name");
}
((obj), E_TYPE_SOURCE_COLLECTION, ESourceCollectionPrivate))
struct _ESourceCollectionPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *identity;
gboolean calendar_enabled;
gboolean contacts_enabled;
priv = E_SOURCE_COLLECTION_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->identity);
e_source_collection_init (ESourceCollection *extension)
{
extension->priv = E_SOURCE_COLLECTION_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_COLLECTION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_collection_get_identity (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_COLLECTION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->identity, identity) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->identity);
extension->priv->identity = e_util_strdup_strip (identity);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "identity");
}
((obj), E_TYPE_SOURCE_GOA, ESourceGoaPrivate))
struct _ESourceGoaPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *account_id;
};
priv = E_SOURCE_GOA_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->account_id);
e_source_goa_init (ESourceGoa *extension)
{
extension->priv = E_SOURCE_GOA_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_GOA (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_goa_get_account_id (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_GOA (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->account_id, account_id) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->account_id);
extension->priv->account_id = e_util_strdup_strip (account_id);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "account-id");
}
((obj), E_TYPE_SOURCE_MAIL_ACCOUNT, ESourceMailAccountPrivate))
struct _ESourceMailAccountPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *identity_uid;
};
priv = E_SOURCE_MAIL_ACCOUNT_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->identity_uid);
e_source_mail_account_init (ESourceMailAccount *extension)
{
extension->priv = E_SOURCE_MAIL_ACCOUNT_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_MAIL_ACCOUNT (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_account_get_identity_uid (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_ACCOUNT (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->identity_uid, identity_uid) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->identity_uid);
extension->priv->identity_uid = g_strdup (identity_uid);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "identity-uid");
}
((obj), E_TYPE_SOURCE_MAIL_COMPOSITION, ESourceMailCompositionPrivate))
struct _ESourceMailCompositionPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar **bcc;
gchar **cc;
gchar *drafts_folder;
priv = E_SOURCE_MAIL_COMPOSITION_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_strfreev (priv->bcc);
g_strfreev (priv->cc);
e_source_mail_composition_init (ESourceMailComposition *extension)
{
extension->priv = E_SOURCE_MAIL_COMPOSITION_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_composition_get_bcc (extension);
duplicate = g_strdupv ((gchar **) protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (strv_equal ((const gchar * const *) extension->priv->bcc, bcc)) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_strfreev (extension->priv->bcc);
extension->priv->bcc = g_strdupv ((gchar **) bcc);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "bcc");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_composition_get_cc (extension);
duplicate = g_strdupv ((gchar **) protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (strv_equal ((const gchar * const *) extension->priv->cc, cc)) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_strfreev (extension->priv->cc);
extension->priv->cc = g_strdupv ((gchar **) cc);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "cc");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_composition_get_drafts_folder (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->drafts_folder, drafts_folder) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->drafts_folder);
extension->priv->drafts_folder = e_util_strdup_strip (drafts_folder);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "drafts-folder");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_composition_get_templates_folder (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->templates_folder, templates_folder) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->templates_folder);
extension->priv->templates_folder = e_util_strdup_strip (templates_folder);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "templates-folder");
}
((obj), E_TYPE_SOURCE_MAIL_IDENTITY, ESourceMailIdentityPrivate))
struct _ESourceMailIdentityPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *address;
gchar *name;
gchar *organization;
priv = E_SOURCE_MAIL_IDENTITY_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->address);
g_free (priv->name);
e_source_mail_identity_init (ESourceMailIdentity *extension)
{
extension->priv = E_SOURCE_MAIL_IDENTITY_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_identity_get_address (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->address, address) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->address);
extension->priv->address = e_util_strdup_strip (address);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "address");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_identity_get_name (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (extension->priv->name != NULL &&
g_strcmp0 (extension->priv->name, name) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
if (extension->priv->name == NULL)
extension->priv->name = g_strdup (g_get_real_name ());
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "name");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_identity_get_organization (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->organization, organization) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->organization);
extension->priv->organization = e_util_strdup_strip (organization);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "organization");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_identity_get_reply_to (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->reply_to, reply_to) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->reply_to);
extension->priv->reply_to = e_util_strdup_strip (reply_to);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "reply-to");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_IDENTITY (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_identity_get_signature_uid (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
if (signature_uid == NULL || *signature_uid == '\0')
signature_uid = "none";
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->signature_uid, signature_uid) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->signature_uid);
extension->priv->signature_uid = g_strdup (signature_uid);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "signature-uid");
}
typedef struct _AsyncContext AsyncContext;
struct _ESourceMailSignaturePrivate {
- GMutex *property_lock;
+ GMutex property_lock;
GFile *file;
gchar *mime_type;
};
priv = E_SOURCE_MAIL_SIGNATURE_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->mime_type);
e_source_mail_signature_init (ESourceMailSignature *extension)
{
extension->priv = E_SOURCE_MAIL_SIGNATURE_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_MAIL_SIGNATURE (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_signature_get_mime_type (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_SIGNATURE (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->mime_type, mime_type) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->mime_type);
extension->priv->mime_type = e_util_strdup_strip (mime_type);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "mime-type");
}
((obj), E_TYPE_SOURCE_MAIL_SUBMISSION, ESourceMailSubmissionPrivate))
struct _ESourceMailSubmissionPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *sent_folder;
gchar *transport_uid;
gboolean replies_to_origin_folder;
priv = E_SOURCE_MAIL_SUBMISSION_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->sent_folder);
g_free (priv->transport_uid);
e_source_mail_submission_init (ESourceMailSubmission *extension)
{
extension->priv = E_SOURCE_MAIL_SUBMISSION_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_submission_get_sent_folder (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->sent_folder, sent_folder) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->sent_folder);
extension->priv->sent_folder = e_util_strdup_strip (sent_folder);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "sent-folder");
}
g_return_val_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_mail_submission_get_transport_uid (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_MAIL_SUBMISSION (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->transport_uid, transport_uid) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->transport_uid);
extension->priv->transport_uid = g_strdup (transport_uid);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "transport-uid");
}
((obj), E_TYPE_SOURCE_OPENPGP, ESourceOpenPGPPrivate))
struct _ESourceOpenPGPPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *key_id;
gchar *signing_algorithm;
priv = E_SOURCE_OPENPGP_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->key_id);
g_free (priv->signing_algorithm);
e_source_openpgp_init (ESourceOpenPGP *extension)
{
extension->priv = E_SOURCE_OPENPGP_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_OPENPGP (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_openpgp_get_key_id (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_OPENPGP (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->key_id, key_id) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->key_id);
extension->priv->key_id = e_util_strdup_strip (key_id);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "key-id");
}
g_return_val_if_fail (E_IS_SOURCE_OPENPGP (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_openpgp_get_signing_algorithm (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_OPENPGP (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->signing_algorithm, signing_algorithm) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
extension->priv->signing_algorithm =
e_util_strdup_strip (signing_algorithm);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "signing-algorithm");
}
gboolean enabled;
guint interval_minutes;
- GMutex *timeout_lock;
+ GMutex timeout_lock;
GHashTable *timeout_table;
guint next_timeout_id;
};
{
GList *list, *link;
- g_mutex_lock (extension->priv->timeout_lock);
+ g_mutex_lock (&extension->priv->timeout_lock);
list = g_hash_table_get_values (extension->priv->timeout_table);
g_list_free (list);
- g_mutex_unlock (extension->priv->timeout_lock);
+ g_mutex_unlock (&extension->priv->timeout_lock);
}
static gboolean
priv = E_SOURCE_REFRESH_GET_PRIVATE (object);
- g_mutex_free (priv->timeout_lock);
+ g_mutex_clear (&priv->timeout_lock);
g_hash_table_destroy (priv->timeout_table);
/* Chain up to parent's finalize() method. */
(GDestroyNotify) timeout_node_free);
extension->priv = E_SOURCE_REFRESH_GET_PRIVATE (extension);
- extension->priv->timeout_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->timeout_lock);
extension->priv->timeout_table = timeout_table;
extension->priv->next_timeout_id = 1;
}
extension_name = E_SOURCE_EXTENSION_REFRESH;
extension = e_source_get_extension (source, extension_name);
- g_mutex_lock (extension->priv->timeout_lock);
+ g_mutex_lock (&extension->priv->timeout_lock);
timeout_id = extension->priv->next_timeout_id++;
if (e_source_refresh_get_enabled (extension))
timeout_node_attach (node);
- g_mutex_unlock (extension->priv->timeout_lock);
+ g_mutex_unlock (&extension->priv->timeout_lock);
return timeout_id;
}
extension_name = E_SOURCE_EXTENSION_REFRESH;
extension = e_source_get_extension (source, extension_name);
- g_mutex_lock (extension->priv->timeout_lock);
+ g_mutex_lock (&extension->priv->timeout_lock);
key = GUINT_TO_POINTER (refresh_timeout_id);
removed = g_hash_table_remove (extension->priv->timeout_table, key);
- g_mutex_unlock (extension->priv->timeout_lock);
+ g_mutex_unlock (&extension->priv->timeout_lock);
return removed;
}
extension_name = E_SOURCE_EXTENSION_REFRESH;
extension = e_source_get_extension (source, extension_name);
- g_mutex_lock (extension->priv->timeout_lock);
+ g_mutex_lock (&extension->priv->timeout_lock);
g_hash_table_iter_init (&iter, extension->priv->timeout_table);
if (g_hash_table_remove (extension->priv->timeout_table, key))
n_removed++;
- g_mutex_unlock (extension->priv->timeout_lock);
+ g_mutex_unlock (&extension->priv->timeout_lock);
return n_removed;
}
EDBusSourceManager *dbus_source_manager;
GHashTable *object_path_table;
- GMutex *object_path_table_lock;
+ GMutex object_path_table_lock;
GHashTable *sources;
- GMutex *sources_lock;
+ GMutex sources_lock;
GSettings *settings;
};
ESourceRegistry *registry;
GMainContext *main_context;
GMainLoop *main_loop;
- GCond *main_loop_cond;
- GMutex *main_loop_mutex;
+ GCond main_loop_cond;
+ GMutex main_loop_mutex;
GError *error;
};
g_main_context_unref (closure->main_context);
g_main_loop_unref (closure->main_loop);
- g_cond_free (closure->main_loop_cond);
- g_mutex_free (closure->main_loop_mutex);
+ g_cond_clear (&closure->main_loop_cond);
+ g_mutex_clear (&closure->main_loop_mutex);
/* The GError should be NULL at this point,
* regardless of whether an error occurred. */
g_return_if_fail (object_path != NULL);
g_return_if_fail (E_IS_SOURCE (source));
- g_mutex_lock (registry->priv->object_path_table_lock);
+ g_mutex_lock (®istry->priv->object_path_table_lock);
g_hash_table_insert (
registry->priv->object_path_table,
g_strdup (object_path),
g_object_ref (source));
- g_mutex_unlock (registry->priv->object_path_table_lock);
+ g_mutex_unlock (®istry->priv->object_path_table_lock);
}
static ESource *
g_return_val_if_fail (object_path != NULL, NULL);
- g_mutex_lock (registry->priv->object_path_table_lock);
+ g_mutex_lock (®istry->priv->object_path_table_lock);
source = g_hash_table_lookup (
registry->priv->object_path_table, object_path);
if (source != NULL)
g_object_ref (source);
- g_mutex_unlock (registry->priv->object_path_table_lock);
+ g_mutex_unlock (®istry->priv->object_path_table_lock);
return source;
}
g_return_val_if_fail (object_path != NULL, FALSE);
- g_mutex_lock (registry->priv->object_path_table_lock);
+ g_mutex_lock (®istry->priv->object_path_table_lock);
removed = g_hash_table_remove (
registry->priv->object_path_table, object_path);
- g_mutex_unlock (registry->priv->object_path_table_lock);
+ g_mutex_unlock (®istry->priv->object_path_table_lock);
return removed;
}
uid = e_source_get_uid (source);
g_return_if_fail (uid != NULL);
- g_mutex_lock (registry->priv->sources_lock);
+ g_mutex_lock (®istry->priv->sources_lock);
g_hash_table_insert (
registry->priv->sources,
g_strdup (uid), g_object_ref (source));
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
}
static gboolean
uid = e_source_get_uid (source);
g_return_val_if_fail (uid != NULL, FALSE);
- g_mutex_lock (registry->priv->sources_lock);
+ g_mutex_lock (®istry->priv->sources_lock);
removed = g_hash_table_remove (registry->priv->sources, uid);
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
return removed;
}
g_return_val_if_fail (uid != NULL, NULL);
- g_mutex_lock (registry->priv->sources_lock);
+ g_mutex_lock (®istry->priv->sources_lock);
source = g_hash_table_lookup (registry->priv->sources, uid);
if (source != NULL)
g_object_ref (source);
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
return source;
}
{
GList *values;
- g_mutex_lock (registry->priv->sources_lock);
+ g_mutex_lock (®istry->priv->sources_lock);
values = g_hash_table_get_values (registry->priv->sources);
g_list_foreach (values, (GFunc) g_object_ref, NULL);
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
return values;
}
GHashTableIter iter;
gpointer key, value;
- g_mutex_lock (registry->priv->sources_lock);
+ g_mutex_lock (®istry->priv->sources_lock);
root = g_node_new (NULL);
index = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_destroy (index);
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
return root;
}
uid = e_source_get_uid (source);
g_return_if_fail (uid != NULL);
- g_mutex_lock (registry->priv->sources_lock);
+ g_mutex_lock (®istry->priv->sources_lock);
/* Check if we already have this source in the registry. */
if (g_hash_table_lookup (registry->priv->sources, uid) != NULL) {
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
return;
}
G_CALLBACK (source_registry_source_notify_enabled_cb),
registry);
- g_mutex_unlock (registry->priv->sources_lock);
+ g_mutex_unlock (®istry->priv->sources_lock);
source_registry_sources_insert (registry, source);
}
{
ThreadClosure *closure = data;
- g_mutex_lock (closure->main_loop_mutex);
- g_cond_broadcast (closure->main_loop_cond);
- g_mutex_unlock (closure->main_loop_mutex);
+ g_mutex_lock (&closure->main_loop_mutex);
+ g_cond_broadcast (&closure->main_loop_cond);
+ g_mutex_unlock (&closure->main_loop_mutex);
return FALSE;
}
priv = E_SOURCE_REGISTRY_GET_PRIVATE (object);
g_hash_table_destroy (priv->object_path_table);
- g_mutex_free (priv->object_path_table_lock);
+ g_mutex_clear (&priv->object_path_table_lock);
g_hash_table_destroy (priv->sources);
- g_mutex_free (priv->sources_lock);
+ g_mutex_clear (&priv->sources_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_source_registry_parent_class)->finalize (object);
* we wait for the main loop to start running as a way of
* synchronizing with the manager thread. */
closure->main_loop = g_main_loop_new (closure->main_context, FALSE);
- closure->main_loop_cond = g_cond_new ();
- closure->main_loop_mutex = g_mutex_new ();
+ g_cond_init (&closure->main_loop_cond);
+ g_mutex_init (&closure->main_loop_mutex);
registry->priv->thread_closure = closure;
- registry->priv->manager_thread = g_thread_create (
+ registry->priv->manager_thread = g_thread_new (NULL,
source_registry_object_manager_thread,
- closure, TRUE /* joinable */, error);
+ closure);
if (registry->priv->manager_thread == NULL)
return FALSE;
/* Wait for notification that the manager
* thread's main loop has been started. */
- g_mutex_lock (closure->main_loop_mutex);
+ g_mutex_lock (&closure->main_loop_mutex);
while (!g_main_loop_is_running (closure->main_loop))
g_cond_wait (
- closure->main_loop_cond,
- closure->main_loop_mutex);
- g_mutex_unlock (closure->main_loop_mutex);
+ &closure->main_loop_cond,
+ &closure->main_loop_mutex);
+ g_mutex_unlock (&closure->main_loop_mutex);
/* Check for error in the manager thread. */
if (closure->error != NULL) {
(GDestroyNotify) g_free,
(GDestroyNotify) g_object_unref);
- registry->priv->object_path_table_lock = g_mutex_new ();
+ g_mutex_init (®istry->priv->object_path_table_lock);
/* UID string -> ESource */
registry->priv->sources = g_hash_table_new_full (
(GDestroyNotify) g_free,
(GDestroyNotify) source_registry_unref_source);
- registry->priv->sources_lock = g_mutex_new ();
+ g_mutex_init (®istry->priv->sources_lock);
registry->priv->settings = g_settings_new (GSETTINGS_SCHEMA);
((obj), E_TYPE_SOURCE_RESOURCE, ESourceResourcePrivate))
struct _ESourceResourcePrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *identity;
};
priv = E_SOURCE_RESOURCE_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->identity);
e_source_resource_init (ESourceResource *extension)
{
extension->priv = E_SOURCE_RESOURCE_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_RESOURCE (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_resource_get_identity (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_RESOURCE (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->identity, identity) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->identity);
extension->priv->identity = e_util_strdup_strip (identity);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "identity");
}
#define SECURE_METHOD "tls"
struct _ESourceSecurityPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *method;
};
priv = E_SOURCE_SECURITY_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->method);
e_source_security_init (ESourceSecurity *extension)
{
extension->priv = E_SOURCE_SECURITY_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_SECURITY (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_security_get_method (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
g_return_if_fail (E_IS_SOURCE_SECURITY (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (extension->priv->method &&
g_strcmp0 (extension->priv->method, method) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
if (extension->priv->method == NULL)
extension->priv->method = g_strdup ("none");
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
object = G_OBJECT (extension);
g_object_freeze_notify (object);
((obj), E_TYPE_SOURCE_SELECTABLE, ESourceSelectablePrivate))
struct _ESourceSelectablePrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *color;
gboolean selected;
};
priv = E_SOURCE_SELECTABLE_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->color);
e_source_selectable_init (ESourceSelectable *extension)
{
extension->priv = E_SOURCE_SELECTABLE_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_SELECTABLE (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_selectable_get_color (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_SELECTABLE (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->color, color) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->color);
extension->priv->color = e_util_strdup_strip (color);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "color");
}
((obj), E_TYPE_SOURCE_SMIME, ESourceSMIMEPrivate))
struct _ESourceSMIMEPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *encryption_certificate;
gchar *signing_algorithm;
gchar *signing_certificate;
priv = E_SOURCE_SMIME_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->encryption_certificate);
g_free (priv->signing_algorithm);
e_source_smime_init (ESourceSMIME *extension)
{
extension->priv = E_SOURCE_SMIME_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
}
/**
g_return_val_if_fail (E_IS_SOURCE_SMIME (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_smime_get_encryption_certificate (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_SMIME (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (
extension->priv->encryption_certificate,
encryption_certificate) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
extension->priv->encryption_certificate =
e_util_strdup_strip (encryption_certificate);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "encryption-certificate");
}
g_return_val_if_fail (E_IS_SOURCE_SMIME (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_smime_get_signing_algorithm (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_SMIME (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->signing_algorithm, signing_algorithm) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
extension->priv->signing_algorithm =
e_util_strdup_strip (signing_algorithm);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "signing-algorithm");
}
g_return_val_if_fail (E_IS_SOURCE_SMIME (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_smime_get_signing_certificate (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_SMIME (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->signing_certificate, signing_certificate) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
extension->priv->signing_certificate =
e_util_strdup_strip (signing_certificate);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "signing-certificate");
}
((obj), E_TYPE_SOURCE_WEBDAV, ESourceWebdavPrivate))
struct _ESourceWebdavPrivate {
- GMutex *property_lock;
+ GMutex property_lock;
gchar *display_name;
gchar *email_address;
gchar *resource_path;
/* Do not use e_source_webdav_dup_soup_uri() here. That
* builds the URI from properties we haven't yet updated. */
- g_mutex_lock (webdav_extension->priv->property_lock);
+ g_mutex_lock (&webdav_extension->priv->property_lock);
soup_uri = soup_uri_copy (webdav_extension->priv->soup_uri);
- g_mutex_unlock (webdav_extension->priv->property_lock);
+ g_mutex_unlock (&webdav_extension->priv->property_lock);
extension = E_SOURCE_EXTENSION (webdav_extension);
source = e_source_extension_ref_source (extension);
g_object_unref (source);
- g_mutex_lock (webdav_extension->priv->property_lock);
+ g_mutex_lock (&webdav_extension->priv->property_lock);
soup_uri = webdav_extension->priv->soup_uri;
soup_uri_set_query (soup_uri, query);
- g_mutex_unlock (webdav_extension->priv->property_lock);
+ g_mutex_unlock (&webdav_extension->priv->property_lock);
g_free (user);
g_free (host);
priv = E_SOURCE_WEBDAV_GET_PRIVATE (object);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->display_name);
g_free (priv->email_address);
e_source_webdav_init (ESourceWebdav *extension)
{
extension->priv = E_SOURCE_WEBDAV_GET_PRIVATE (extension);
- extension->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&extension->priv->property_lock);
/* Initialize this enough for SOUP_URI_IS_VALID() to pass. */
extension->priv->soup_uri = soup_uri_new (NULL);
g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_webdav_get_display_name (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->display_name, display_name) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->display_name);
extension->priv->display_name = e_util_strdup_strip (display_name);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "display-name");
}
g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_webdav_get_email_address (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->email_address, email_address) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->email_address);
extension->priv->email_address = e_util_strdup_strip (email_address);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "email-address");
}
g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_webdav_get_resource_path (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->resource_path, resource_path) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->resource_path);
extension->priv->resource_path = e_util_strdup_strip (resource_path);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "resource-path");
}
g_return_val_if_fail (E_IS_SOURCE_WEBDAV (extension), NULL);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
protected = e_source_webdav_get_resource_query (extension);
duplicate = g_strdup (protected);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
if (g_strcmp0 (extension->priv->resource_query, resource_query) == 0) {
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return;
}
g_free (extension->priv->resource_query);
extension->priv->resource_query = e_util_strdup_strip (resource_query);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_notify (G_OBJECT (extension), "resource-query");
}
/* Keep this outside of the property lock. */
source_webdav_update_soup_uri_from_properties (extension);
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
duplicate = soup_uri_copy (extension->priv->soup_uri);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
return duplicate;
}
g_return_if_fail (E_IS_SOURCE_WEBDAV (extension));
g_return_if_fail (SOUP_URI_IS_VALID (soup_uri));
- g_mutex_lock (extension->priv->property_lock);
+ g_mutex_lock (&extension->priv->property_lock);
/* Do not test for URI equality because our
* internal SoupURI might not be up-to-date. */
soup_uri_free (extension->priv->soup_uri);
extension->priv->soup_uri = soup_uri_copy (soup_uri);
- g_mutex_unlock (extension->priv->property_lock);
+ g_mutex_unlock (&extension->priv->property_lock);
g_object_freeze_notify (G_OBJECT (extension));
source_webdav_update_properties_from_soup_uri (extension);
GMainContext *main_context;
GSource *changed;
- GMutex *changed_lock;
+ GMutex changed_lock;
- GMutex *property_lock;
+ GMutex property_lock;
gchar *display_name;
gchar *collate_key;
/* The lock guards the key file and hash table. */
GKeyFile *key_file;
- GStaticRecMutex lock;
+ GRecMutex lock;
GHashTable *extensions;
gboolean enabled;
{
GError *error = NULL;
- g_static_rec_mutex_lock (&source->priv->lock);
+ g_rec_mutex_lock (&source->priv->lock);
/* Since the source data came from a GKeyFile structure on the
* server-side, this should never fail. But we'll print error
g_error_free (error);
}
- g_static_rec_mutex_unlock (&source->priv->lock);
+ g_rec_mutex_unlock (&source->priv->lock);
}
static gboolean
if (!source->priv->initialized)
return TRUE;
- g_mutex_lock (source->priv->changed_lock);
+ g_mutex_lock (&source->priv->changed_lock);
if (source->priv->changed != NULL) {
g_source_unref (source->priv->changed);
source->priv->changed = NULL;
}
- g_mutex_unlock (source->priv->changed_lock);
+ g_mutex_unlock (&source->priv->changed_lock);
g_signal_emit (source, signals[CHANGED], 0);
}
/* XXX Maybe not necessary to acquire the lock? */
- g_mutex_lock (priv->changed_lock);
+ g_mutex_lock (&priv->changed_lock);
if (priv->changed != NULL) {
g_source_destroy (priv->changed);
g_source_unref (priv->changed);
priv->changed = NULL;
}
- g_mutex_unlock (priv->changed_lock);
+ g_mutex_unlock (&priv->changed_lock);
g_hash_table_remove_all (priv->extensions);
priv = E_SOURCE_GET_PRIVATE (object);
- g_mutex_free (priv->changed_lock);
- g_mutex_free (priv->property_lock);
+ g_mutex_clear (&priv->changed_lock);
+ g_mutex_clear (&priv->property_lock);
g_free (priv->display_name);
g_free (priv->collate_key);
g_free (priv->uid);
g_key_file_free (priv->key_file);
- g_static_rec_mutex_free (&priv->lock);
+ g_rec_mutex_clear (&priv->lock);
g_hash_table_destroy (priv->extensions);
/* Chain up to parent's finalize() method. */
}
/* Try to avoid a spurious "changed" emission. */
- g_mutex_lock (source->priv->changed_lock);
+ g_mutex_lock (&source->priv->changed_lock);
if (source->priv->changed != NULL) {
g_source_destroy (source->priv->changed);
g_source_unref (source->priv->changed);
source->priv->changed = NULL;
}
- g_mutex_unlock (source->priv->changed_lock);
+ g_mutex_unlock (&source->priv->changed_lock);
source->priv->initialized = TRUE;
(GDestroyNotify) g_object_unref);
source->priv = E_SOURCE_GET_PRIVATE (source);
- source->priv->changed_lock = g_mutex_new ();
- source->priv->property_lock = g_mutex_new ();
+ g_mutex_init (&source->priv->changed_lock);
+ g_mutex_init (&source->priv->property_lock);
source->priv->key_file = g_key_file_new ();
source->priv->extensions = extensions;
- g_static_rec_mutex_init (&source->priv->lock);
+ g_rec_mutex_init (&source->priv->lock);
}
/**
{
g_return_if_fail (E_IS_SOURCE (source));
- g_mutex_lock (source->priv->changed_lock);
+ g_mutex_lock (&source->priv->changed_lock);
if (source->priv->changed == NULL) {
source->priv->changed = g_idle_source_new ();
g_source_set_callback (
source->priv->changed,
source->priv->main_context);
}
- g_mutex_unlock (source->priv->changed_lock);
+ g_mutex_unlock (&source->priv->changed_lock);
}
/**
/* Perhaps we don't need to lock the mutex since
* this is a read-only property but it can't hurt. */
- g_mutex_lock (source->priv->property_lock);
+ g_mutex_lock (&source->priv->property_lock);
protected = e_source_get_uid (source);
duplicate = g_strdup (protected);
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
return duplicate;
}
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- g_mutex_lock (source->priv->property_lock);
+ g_mutex_lock (&source->priv->property_lock);
protected = e_source_get_parent (source);
duplicate = g_strdup (protected);
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
return duplicate;
}
{
g_return_if_fail (E_IS_SOURCE (source));
- g_mutex_lock (source->priv->property_lock);
+ g_mutex_lock (&source->priv->property_lock);
if (g_strcmp0 (source->priv->parent, parent) == 0) {
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
return;
}
g_free (source->priv->parent);
source->priv->parent = e_util_strdup_strip (parent);
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
g_object_notify (G_OBJECT (source), "parent");
}
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
g_return_val_if_fail (extension_name != NULL, NULL);
- g_static_rec_mutex_lock (&source->priv->lock);
+ g_rec_mutex_lock (&source->priv->lock);
/* Check if we already have the extension. */
extension = g_hash_table_lookup (
g_hash_table_destroy (hash_table);
exit:
- g_static_rec_mutex_unlock (&source->priv->lock);
+ g_rec_mutex_unlock (&source->priv->lock);
return extension;
}
g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
g_return_val_if_fail (extension_name != NULL, FALSE);
- g_static_rec_mutex_lock (&source->priv->lock);
+ g_rec_mutex_lock (&source->priv->lock);
/* Two cases to check for, either one is good enough:
* 1) Our internal GKeyFile has a group named 'extension_name'.
extension = g_hash_table_lookup (hash_table, extension_name);
}
- g_static_rec_mutex_unlock (&source->priv->lock);
+ g_rec_mutex_unlock (&source->priv->lock);
return (extension != NULL);
}
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- g_mutex_lock (source->priv->property_lock);
+ g_mutex_lock (&source->priv->property_lock);
protected = e_source_get_display_name (source);
duplicate = g_strdup (protected);
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
return duplicate;
}
g_return_if_fail (display_name != NULL);
g_return_if_fail (g_utf8_validate (display_name, -1, NULL));
- g_mutex_lock (source->priv->property_lock);
+ g_mutex_lock (&source->priv->property_lock);
if (g_strcmp0 (source->priv->display_name, display_name) == 0) {
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
return;
}
g_free (source->priv->collate_key);
source->priv->collate_key = g_utf8_collate_key (display_name, -1);
- g_mutex_unlock (source->priv->property_lock);
+ g_mutex_unlock (&source->priv->property_lock);
g_object_notify (G_OBJECT (source), "display-name");
}
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- g_static_rec_mutex_lock (&source->priv->lock);
+ g_rec_mutex_lock (&source->priv->lock);
key_file = source->priv->key_file;
data = g_key_file_to_data (key_file, length, NULL);
- g_static_rec_mutex_unlock (&source->priv->lock);
+ g_rec_mutex_unlock (&source->priv->lock);
return data;
}
g_return_val_if_fail (idle->func != NULL, FALSE);
if (idle->run_in_thread) {
- GError *error = NULL;
+ GThread *thread;
- g_thread_create (idle->func, idle->data, FALSE, &error);
-
- if (error) {
- report_error ("create thread", &error);
- stop_main_loop (1);
- }
+ thread = g_thread_new (NULL, idle->func, idle->data);
+ g_thread_unref (thread);
} else {
idle->func (idle->data);
}
g_return_val_if_fail (idle->func != NULL, FALSE);
if (idle->run_in_thread) {
- GError *error = NULL;
+ GThread *thread;
- g_thread_create (idle->func, idle->data, FALSE, &error);
-
- if (error) {
- report_error ("create thread", &error);
- stop_main_loop (1);
- }
+ thread = g_thread_new (NULL, idle->func, idle->data);
+ g_thread_unref (thread);
} else {
idle->func (idle->data);
}