evolution-data-server/evolution-data-server-1.9.92-e-flag.patch
Matthew Barnes ab62852749 - Add patch for GNOME bug #415891 (introduce EFlag API).
- Add patch for GNOME bug #376991 (refactor password handling).
2007-03-09 15:52:08 +00:00

2164 lines
52 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- /dev/null 2007-03-08 09:20:11.212292094 -0500
+++ evolution-data-server-1.9.92/libedataserver/e-flag.c 2007-03-08 17:16:18.000000000 -0500
@@ -0,0 +1,171 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "e-flag.h"
+
+struct _EFlag {
+ GCond *cond;
+ GMutex *mutex;
+ gboolean is_set;
+};
+
+/**
+ * e_flag_new:
+ *
+ * Creates a new #EFlag object. It is initially unset.
+ *
+ * Returns: a new #EFlag
+ **/
+EFlag *
+e_flag_new (void)
+{
+ EFlag *flag;
+
+ flag = g_slice_new (EFlag);
+ flag->cond = g_cond_new ();
+ flag->mutex = g_mutex_new ();
+ flag->is_set = FALSE;
+
+ return flag;
+}
+
+/**
+ * e_flag_is_set:
+ * @flag: an #EFlag
+ *
+ * Returns the state of @flag.
+ *
+ * Returns: %TRUE if @flag is set
+ **/
+gboolean
+e_flag_is_set (EFlag *flag)
+{
+ gboolean is_set;
+
+ g_return_val_if_fail (flag != NULL, FALSE);
+
+ g_mutex_lock (flag->mutex);
+ is_set = flag->is_set;
+ g_mutex_unlock (flag->mutex);
+
+ return is_set;
+}
+
+/**
+ * e_flag_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
+ * block at all.
+ **/
+void
+e_flag_set (EFlag *flag)
+{
+ g_return_if_fail (flag != NULL);
+
+ g_mutex_lock (flag->mutex);
+ flag->is_set = TRUE;
+ 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()
+ * will block until @flag is set.
+ **/
+void
+e_flag_clear (EFlag *flag)
+{
+ g_return_if_fail (flag != NULL);
+
+ g_mutex_lock (flag->mutex);
+ flag->is_set = FALSE;
+ g_mutex_unlock (flag->mutex);
+}
+
+/**
+ * e_flag_wait:
+ * @flag: an #EFlag
+ *
+ * Blocks until @flag is set. If @flag is already set, the function returns
+ * immediately.
+ **/
+void
+e_flag_wait (EFlag *flag)
+{
+ g_return_if_fail (flag != NULL);
+
+ g_mutex_lock (flag->mutex);
+ while (!flag->is_set)
+ g_cond_wait (flag->cond, flag->mutex);
+ g_mutex_unlock (flag->mutex);
+}
+
+/**
+ * e_flag_timed_wait:
+ * @flag: an #EFlag
+ * @abs_time: a #GTimeVal, determining the final time
+ *
+ * Blocks until @flag is set, or until the time specified by @abs_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.
+ *
+ * Returns: %TRUE if @flag is now set
+ **/
+gboolean
+e_flag_timed_wait (EFlag *flag, GTimeVal *abs_time)
+{
+ gboolean is_set;
+
+ g_return_val_if_fail (flag != NULL, FALSE);
+
+ g_mutex_lock (flag->mutex);
+ while (!flag->is_set)
+ if (!g_cond_timed_wait (flag->cond, flag->mutex, abs_time))
+ break;
+ is_set = flag->is_set;
+ g_mutex_unlock (flag->mutex);
+
+ return is_set;
+}
+
+/**
+ * e_flag_free:
+ * @flag: an #EFlag
+ *
+ * Destroys @flag.
+ **/
+void
+e_flag_free (EFlag *flag)
+{
+ g_return_if_fail (flag != NULL);
+
+ g_cond_free (flag->cond);
+ g_mutex_free (flag->mutex);
+ g_slice_free (EFlag, flag);
+}
--- /dev/null 2007-03-08 09:20:11.212292094 -0500
+++ evolution-data-server-1.9.92/libedataserver/e-flag.h 2007-03-08 17:16:18.000000000 -0500
@@ -0,0 +1,43 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef E_FLAG_H
+#define E_FLAG_H
+
+/* An EFlag is essentially a binary semaphore with a more intuitive interface.
+ * Based on Python's threading.Event class ("EEvent" was already taken). */
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EFlag EFlag;
+
+EFlag * e_flag_new (void);
+gboolean e_flag_is_set (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);
+void e_flag_free (EFlag *flag);
+
+G_END_DECLS
+
+#endif /* E_FLAG_H */
--- evolution-data-server-1.9.92/libedataserver/Makefile.in.e-flag 2007-02-26 08:32:13.000000000 -0500
+++ evolution-data-server-1.9.92/libedataserver/Makefile.in 2007-03-08 17:16:18.000000000 -0500
@@ -69,7 +69,7 @@
am_libedataserver_1_2_la_OBJECTS = $(am__objects_1) e-account-list.lo \
e-account.lo e-categories.lo e-component-listener.lo \
e-data-server-module.lo e-dbhash.lo e-db3-utils.lo \
- e-file-cache.lo e-iconv.lo e-iterator.lo e-list.lo \
+ e-file-cache.lo e-flag.lo e-iconv.lo e-iterator.lo e-list.lo \
e-list-iterator.lo e-memory.lo e-msgport.lo e-sexp.lo \
e-source-group.lo e-source-list.lo e-source.lo e-time-utils.lo \
e-uid.lo e-url.lo e-data-server-util.lo e-trie.lo \
@@ -420,6 +420,7 @@
e-dbhash.c \
e-db3-utils.c \
e-file-cache.c \
+ e-flag.c \
e-iconv.c \
e-iterator.c \
e-list.c \
@@ -459,6 +460,7 @@
e-db3-utils.h \
e-dbhash.h \
e-file-cache.h \
+ e-flag.h \
e-iconv.h \
e-iterator.h \
e-list.h \
@@ -577,6 +579,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-db3-utils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-dbhash.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-file-cache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-flag.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-iconv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-iterator.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/e-list-iterator.Plo@am__quote@
--- evolution-data-server-1.9.92/libedataserver/Makefile.am.e-flag 2007-01-03 09:56:27.000000000 -0500
+++ evolution-data-server-1.9.92/libedataserver/Makefile.am 2007-03-08 17:16:18.000000000 -0500
@@ -26,6 +26,7 @@
e-dbhash.c \
e-db3-utils.c \
e-file-cache.c \
+ e-flag.c \
e-iconv.c \
e-iterator.c \
e-list.c \
@@ -66,6 +67,7 @@
e-db3-utils.h \
e-dbhash.h \
e-file-cache.h \
+ e-flag.h \
e-iconv.h \
e-iterator.h \
e-list.h \
--- evolution-data-server-1.9.92/addressbook/backends/file/e-book-backend-file.c.e-flag 2007-01-03 09:56:28.000000000 -0500
+++ evolution-data-server-1.9.92/addressbook/backends/file/e-book-backend-file.c 2007-03-09 00:22:01.000000000 -0500
@@ -43,6 +43,7 @@
#include "libedataserver/e-dbhash.h"
#include "libedataserver/e-db3-utils.h"
#include "libedataserver/e-data-server-util.h"
+#include "libedataserver/e-flag.h"
#include "libebook/e-contact.h"
@@ -479,18 +480,15 @@
typedef struct {
EBookBackendFile *bf;
- GMutex *mutex;
- GCond *cond;
GThread *thread;
- gboolean stopped;
+ EFlag *running;
} FileBackendSearchClosure;
static void
closure_destroy (FileBackendSearchClosure *closure)
{
d(printf ("destroying search closure\n"));
- g_mutex_free (closure->mutex);
- g_cond_free (closure->cond);
+ e_flag_free (closure->running);
g_free (closure);
}
@@ -500,10 +498,8 @@
FileBackendSearchClosure *closure = g_new (FileBackendSearchClosure, 1);
closure->bf = bf;
- closure->mutex = g_mutex_new ();
- closure->cond = g_cond_new ();
closure->thread = NULL;
- closure->stopped = FALSE;
+ closure->running = e_flag_new ();
g_object_set_data_full (G_OBJECT (book_view), "EBookBackendFile.BookView::closure",
closure, (GDestroyNotify)closure_destroy);
@@ -527,7 +523,7 @@
DB *db;
DBT id_dbt, vcard_dbt;
int db_error;
- gboolean stopped = FALSE, allcontacts;
+ gboolean allcontacts;
d(printf ("starting initial population of book view\n"));
@@ -547,9 +543,7 @@
}
d(printf ("signalling parent thread\n"));
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ e_flag_set (closure->running);
if (e_book_backend_summary_is_summary_query (bf->priv->summary, query)) {
/* do a summary query */
@@ -558,11 +552,8 @@
for (i = 0; i < ids->len; i ++) {
char *id = g_ptr_array_index (ids, i);
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
- if (stopped)
+ if (!e_flag_is_set (closure->running))
break;
string_to_dbt (id, &id_dbt);
@@ -595,11 +586,7 @@
db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_FIRST);
while (db_error == 0) {
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
-
- if (stopped)
+ if (!e_flag_is_set (closure->running))
break;
/* don't include the version in the list of cards */
@@ -628,7 +615,7 @@
}
- if (!stopped)
+ if (e_flag_is_set (closure->running))
e_data_book_view_notify_complete (book_view, GNOME_Evolution_Addressbook_Success);
/* unref the */
@@ -646,15 +633,12 @@
{
FileBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_FILE (backend));
- g_mutex_lock (closure->mutex);
-
d(printf ("starting book view thread\n"));
closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
- g_cond_wait (closure->cond, closure->mutex);
+ e_flag_wait (closure->running);
/* at this point we know the book view thread is actually running */
- g_mutex_unlock (closure->mutex);
d(printf ("returning from start_book_view\n"));
}
@@ -663,14 +647,11 @@
EDataBookView *book_view)
{
FileBackendSearchClosure *closure = get_closure (book_view);
- gboolean need_join = FALSE;
+ gboolean need_join;
d(printf ("stopping query\n"));
- g_mutex_lock (closure->mutex);
- if (!closure->stopped)
- need_join = TRUE;
- closure->stopped = TRUE;
- g_mutex_unlock (closure->mutex);
+ need_join = e_flag_is_set (closure->running);
+ e_flag_clear (closure->running);
if (need_join)
g_thread_join (closure->thread);
--- evolution-data-server-1.9.92/addressbook/backends/groupwise/e-book-backend-groupwise.c.e-flag 2007-01-03 09:56:29.000000000 -0500
+++ evolution-data-server-1.9.92/addressbook/backends/groupwise/e-book-backend-groupwise.c 2007-03-09 00:22:01.000000000 -0500
@@ -40,6 +40,7 @@
#include "libedataserver/e-sexp.h"
#include "libedataserver/e-data-server-util.h"
#include "libedataserver/e-db3-utils.h"
+#include "libedataserver/e-flag.h"
#include "libedataserver/e-url.h"
#include "libebook/e-contact.h"
#include "libedata-book/e-book-backend-sexp.h"
@@ -2070,17 +2071,14 @@
typedef struct {
EBookBackendGroupwise *bg;
- GMutex *mutex;
- GCond *cond;
GThread *thread;
- gboolean stopped;
+ EFlag *running;
} GroupwiseBackendSearchClosure;
static void
closure_destroy (GroupwiseBackendSearchClosure *closure)
{
- g_mutex_free (closure->mutex);
- g_cond_free (closure->cond);
+ e_flag_free (closure->running);
g_free (closure);
}
@@ -2090,10 +2088,8 @@
GroupwiseBackendSearchClosure *closure = g_new (GroupwiseBackendSearchClosure, 1);
closure->bg = bg;
- closure->mutex = g_mutex_new ();
- closure->cond = g_cond_new ();
closure->thread = NULL;
- closure->stopped = FALSE;
+ closure->running = e_flag_new ();
g_object_set_data_full (G_OBJECT (book_view), "EBookBackendGroupwise.BookView::closure",
closure, (GDestroyNotify)closure_destroy);
@@ -2115,19 +2111,14 @@
GroupwiseBackendSearchClosure *closure)
{
int i;
- gboolean stopped = FALSE;
if (enable_debug)
printf ("\nread contacts from cache for the ids found in summary\n");
for (i = 0; i < ids->len; i ++) {
char *uid = g_ptr_array_index (ids, i);
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
-
- if (stopped)
- break;
+ if (!e_flag_is_set (closure->running))
+ break;
EContact *contact =
e_book_backend_db_cache_get_contact (ebgw->priv->file_db, uid);
@@ -2136,7 +2127,7 @@
g_object_unref (contact);
}
}
- if (!stopped)
+ if (e_flag_is_set (closure->running))
e_data_book_view_notify_complete (book_view,
GNOME_Evolution_Addressbook_Success);
}
@@ -2151,7 +2142,6 @@
const char *query = NULL;
EGwFilter *filter = NULL;
GPtrArray *ids = NULL;
- gboolean stopped = FALSE;
EDataBookView *book_view = data;
GroupwiseBackendSearchClosure *closure = get_closure (book_view);
char *view = NULL;
@@ -2166,9 +2156,7 @@
if (enable_debug)
printf ("start book view for %s \n", gwb->priv->book_name);
bonobo_object_ref (book_view);
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ e_flag_set (closure->running);
query = e_data_book_view_get_card_query (book_view);
if (enable_debug)
@@ -2200,10 +2188,7 @@
contacts = e_book_backend_db_cache_get_contacts (gwb->priv->file_db, query);
temp_list = contacts;
for (; contacts != NULL; contacts = g_list_next(contacts)) {
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
- if (stopped) {
+ if (!e_flag_is_set (closure->running)) {
for (;contacts != NULL; contacts = g_list_next (contacts))
g_object_unref (contacts->data);
break;
@@ -2211,7 +2196,7 @@
e_data_book_view_notify_update (book_view, E_CONTACT(contacts->data));
g_object_unref (contacts->data);
}
- if (!stopped)
+ if (e_flag_is_set (closure->running))
e_data_book_view_notify_complete (book_view, GNOME_Evolution_Addressbook_Success);
if (temp_list)
g_list_free (temp_list);
@@ -2339,10 +2324,7 @@
temp_list = gw_items;
for (; gw_items != NULL; gw_items = g_list_next(gw_items)) {
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
- if (stopped) {
+ if (!e_flag_is_set (closure->running)) {
for (;gw_items != NULL; gw_items = g_list_next (gw_items))
g_object_unref (gw_items->data);
break;
@@ -2363,7 +2345,7 @@
}
if (temp_list)
g_list_free (temp_list);
- if (!stopped)
+ if (e_flag_is_set (closure->running))
e_data_book_view_notify_complete (book_view, GNOME_Evolution_Addressbook_Success);
if (filter)
g_object_unref (filter);
@@ -2392,12 +2374,10 @@
if (enable_debug)
printf ("\ne_book_backend_groupwise_start_book_view...\n");
- g_mutex_lock (closure->mutex);
closure->thread = g_thread_create (book_view_thread, book_view, FALSE, NULL);
- g_cond_wait (closure->cond, closure->mutex);
+ e_flag_wait (closure->running);
/* at this point we know the book view thread is actually running */
- g_mutex_unlock (closure->mutex);
}
static void
@@ -2408,10 +2388,7 @@
if (enable_debug)
printf ("\ne_book_backend_groupwise_stop_book_view...\n");
- g_mutex_lock (closure->mutex);
- if (!closure->stopped)
- closure->stopped = TRUE;
- g_mutex_unlock (closure->mutex);
+ e_flag_clear (closure->running);
}
static void
@@ -2650,11 +2627,8 @@
if (book_view) {
closure = get_closure (book_view);
bonobo_object_ref (book_view);
- if (closure) {
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
- }
+ if (closure)
+ e_flag_set (closure->running);
}
while (!done) {
@@ -2799,11 +2773,8 @@
if (book_view) {
closure = get_closure (book_view);
bonobo_object_ref (book_view);
- if (closure) {
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
- }
+ if (closure)
+ e_flag_set (closure->running);
}
cache_file_name = e_book_backend_db_cache_get_filename(ebgw->priv->file_db);
@@ -2967,11 +2938,8 @@
if (book_view) {
closure = get_closure (book_view);
bonobo_object_ref (book_view);
- if (closure){
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
- }
+ if (closure)
+ e_flag_set (closure->running);
}
/* update the cache */
--- evolution-data-server-1.9.92/addressbook/backends/vcf/e-book-backend-vcf.c.e-flag 2007-01-03 09:56:29.000000000 -0500
+++ evolution-data-server-1.9.92/addressbook/backends/vcf/e-book-backend-vcf.c 2007-03-09 00:22:01.000000000 -0500
@@ -41,6 +41,7 @@
#include <glib/gi18n-lib.h>
#include "libedataserver/e-data-server-util.h"
+#include "libedataserver/e-flag.h"
#include "libebook/e-contact.h"
@@ -427,18 +428,15 @@
typedef struct {
EBookBackendVCF *bvcf;
EDataBookView *view;
- GMutex *mutex;
- GCond *cond;
GThread *thread;
- gboolean stopped;
+ EFlag *running;
} VCFBackendSearchClosure;
static void
closure_destroy (VCFBackendSearchClosure *closure)
{
d(printf ("destroying search closure\n"));
- g_mutex_free (closure->mutex);
- g_cond_free (closure->cond);
+ e_flag_free (closure->running);
g_free (closure);
}
@@ -449,10 +447,8 @@
closure->bvcf = bvcf;
closure->view = book_view;
- closure->mutex = g_mutex_new ();
- closure->cond = g_cond_new ();
closure->thread = NULL;
- closure->stopped = FALSE;
+ closure->running = e_flag_new ();
g_object_set_data_full (G_OBJECT (book_view), "EBookBackendVCF.BookView::closure",
closure, (GDestroyNotify)closure_destroy);
@@ -486,9 +482,7 @@
e_data_book_view_notify_status_message (book_view, _("Searching..."));
d(printf ("signalling parent thread\n"));
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ e_flag_set (closure->running);
for (l = closure->bvcf->priv->contact_list; l; l = l->next) {
char *vcard_string = l->data;
@@ -496,11 +490,11 @@
e_data_book_view_notify_update (closure->view, contact);
g_object_unref (contact);
- if (closure->stopped)
+ if (!e_flag_is_set (closure->running))
break;
}
- if (!closure->stopped)
+ if (e_flag_is_set (closure->running))
e_data_book_view_notify_complete (closure->view, GNOME_Evolution_Addressbook_Success);
/* unref the book view */
@@ -518,15 +512,12 @@
{
VCFBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_VCF (backend));
- g_mutex_lock (closure->mutex);
-
d(printf ("starting book view thread\n"));
closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
- g_cond_wait (closure->cond, closure->mutex);
+ e_flag_wait (closure->running);
/* at this point we know the book view thread is actually running */
- g_mutex_unlock (closure->mutex);
d(printf ("returning from start_book_view\n"));
}
@@ -536,14 +527,11 @@
EDataBookView *book_view)
{
VCFBackendSearchClosure *closure = get_closure (book_view);
- gboolean need_join = FALSE;
+ gboolean need_join;
d(printf ("stopping query\n"));
- g_mutex_lock (closure->mutex);
- if (!closure->stopped)
- need_join = TRUE;
- closure->stopped = TRUE;
- g_mutex_unlock (closure->mutex);
+ need_join = e_flag_is_set (closure->running);
+ e_flag_clear (closure->running);
if (need_join)
g_thread_join (closure->thread);
--- evolution-data-server-1.9.92/docs/reference/libedataserver/libedataserver-docs.sgml.e-flag 2007-01-03 09:56:22.000000000 -0500
+++ evolution-data-server-1.9.92/docs/reference/libedataserver/libedataserver-docs.sgml 2007-03-08 17:16:18.000000000 -0500
@@ -16,6 +16,7 @@
<xi:include href="xml/e-db3-utils.xml"/>
<xi:include href="xml/e-dbhash.xml"/>
<xi:include href="xml/e-file-cache.xml"/>
+ <xi:include href="xml/e-flag.xml"/>
<xi:include href="xml/e-iconv.xml"/>
<xi:include href="xml/e-iterator.xml"/>
<xi:include href="xml/e-list-iterator.xml"/>
--- /dev/null 2007-03-08 09:20:11.212292094 -0500
+++ evolution-data-server-1.9.92/docs/reference/libedataserver/tmpl/e-flag.sgml 2007-03-08 17:16:18.000000000 -0500
@@ -0,0 +1,89 @@
+<!-- ##### SECTION Title ##### -->
+EFlag
+
+<!-- ##### SECTION Short_Description ##### -->
+Simple thread synchronization
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+An #EFlag is a simple thread synchronization mechanism. It implements a
+thread-safe flag that can be blocked on.
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EFlag ##### -->
+<para>
+The <structname>EFlag</structname> struct is an opaque data structure
+representing a thread-safe flag. It should be accessed only by using
+the following functions.
+</para>
+
+
+<!-- ##### FUNCTION e_flag_new ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+
+<!-- ##### FUNCTION e_flag_is_set ##### -->
+<para>
+
+</para>
+
+@flag:
+@Returns:
+
+
+<!-- ##### FUNCTION e_flag_set ##### -->
+<para>
+
+</para>
+
+@flag:
+
+
+<!-- ##### FUNCTION e_flag_clear ##### -->
+<para>
+
+</para>
+
+@flag:
+
+
+<!-- ##### FUNCTION e_flag_wait ##### -->
+<para>
+
+</para>
+
+@flag:
+
+
+<!-- ##### FUNCTION e_flag_timed_wait ##### -->
+<para>
+
+</para>
+
+@flag:
+@abs_time:
+@Returns:
+
+
+<!-- ##### FUNCTION e_flag_free ##### -->
+<para>
+
+</para>
+
+@flag:
+
+
--- evolution-data-server-1.9.92/docs/reference/libedataserver/libedataserver-sections.txt.e-flag 2007-01-03 09:56:22.000000000 -0500
+++ evolution-data-server-1.9.92/docs/reference/libedataserver/libedataserver-sections.txt 2007-03-08 17:16:18.000000000 -0500
@@ -83,6 +83,19 @@
</SECTION>
<SECTION>
+<FILE>e-flag</FILE>
+<TITLE>EFlag</TITLE>
+EFlag
+e_flag_new
+e_flag_is_set
+e_flag_set
+e_flag_clear
+e_flag_wait
+e_flag_timed_wait
+e_flag_free
+</SECTION>
+
+<SECTION>
<FILE>e-iterator</FILE>
<TITLE>EIterator</TITLE>
e_iterator_get
--- evolution-data-server-1.9.92/calendar/libecal/e-cal.c.e-flag 2007-03-08 17:16:18.000000000 -0500
+++ evolution-data-server-1.9.92/calendar/libecal/e-cal.c 2007-03-09 00:22:01.000000000 -0500
@@ -33,6 +33,7 @@
#include <bonobo/bonobo-main.h>
#include <libedataserver/e-component-listener.h>
+#include <libedataserver/e-flag.h>
#include <libedataserver/e-url.h>
#include "e-cal-marshal.h"
#include "e-cal-time-util.h"
@@ -49,8 +50,7 @@
typedef struct {
- GMutex *mutex;
- GCond *cond;
+ EFlag *done;
ECalendarStatus status;
char *uid;
@@ -306,8 +306,7 @@
{
ECalendarOp *op = g_new0 (ECalendarOp, 1);
- op->mutex = g_mutex_new ();
- op->cond = g_cond_new ();
+ op->done = e_flag_new ();
ecal->priv->current_op = op;
@@ -329,8 +328,7 @@
e_calendar_free_op (ECalendarOp *op)
{
/* XXX more stuff here */
- g_cond_free (op->cond);
- g_mutex_free (op->mutex);
+ e_flag_free (op->done);
g_free (op);
}
@@ -448,14 +446,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->bool = read_only;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -477,14 +471,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (address);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -500,14 +490,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (address);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -523,14 +509,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (attribute);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -546,14 +528,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (capabilities);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -569,13 +547,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -591,13 +565,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -613,14 +583,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->uid = g_strdup (uid);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -636,13 +602,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -658,13 +620,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -680,13 +638,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -702,13 +656,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -725,8 +675,6 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->list = g_list_copy (users);
op->string = g_strdup (object);
@@ -734,9 +682,7 @@
for (l = op->list; l; l = l->next)
l->data = g_strdup (l->data);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -752,14 +698,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (object);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -775,14 +717,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (object);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -799,17 +737,13 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->list = g_list_copy (objects);
for (l = op->list; l; l = l->next)
l->data = icalcomponent_new_clone (l->data);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -825,14 +759,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->slist = g_slist_copy (attachments);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -848,15 +778,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->string = g_strdup (object);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
-
+ e_flag_set (op->done);
}
static void
@@ -872,15 +797,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->uid = g_strdup (tzid);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
-
+ e_flag_set (op->done);
}
static void
@@ -896,13 +816,9 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -919,8 +835,6 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->list = g_list_copy (changes);
@@ -934,9 +848,7 @@
l->data = new_ccc;
}
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -953,17 +865,13 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->list = g_list_copy (freebusy);
for (l = op->list; l; l = l->next)
l->data = e_cal_component_clone (l->data);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static void
@@ -979,14 +887,10 @@
return;
}
- g_mutex_lock (op->mutex);
-
op->status = status;
op->query = e_cal_view_new (query, op->listener, ecal);
- g_cond_signal (op->cond);
-
- g_mutex_unlock (op->mutex);
+ e_flag_set (op->done);
}
static gboolean
@@ -1722,7 +1626,6 @@
}
/* start the open operation */
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
g_mutex_unlock (priv->mutex);
@@ -1735,7 +1638,6 @@
if (priv->auth_func == NULL) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
priv->load_state = E_CAL_LOAD_NOT_LOADED;
*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
@@ -1745,7 +1647,6 @@
username = e_source_get_property (priv->source, "username");
if (!username) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
priv->load_state = E_CAL_LOAD_NOT_LOADED;
*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
@@ -1773,7 +1674,6 @@
if (!key) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
priv->load_state = E_CAL_LOAD_NOT_LOADED;
*status = E_CALENDAR_STATUS_URI_NOT_LOADED;
@@ -1784,7 +1684,6 @@
if (!password) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
priv->load_state = E_CAL_LOAD_NOT_LOADED;
*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
@@ -1809,7 +1708,6 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -1823,14 +1721,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
*status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
if (*status == E_CALENDAR_STATUS_OK) {
priv->load_state = E_CAL_LOAD_LOADED;
@@ -1986,8 +1881,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
@@ -1996,7 +1889,6 @@
GNOME_Evolution_Calendar_Cal_remove (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2008,14 +1900,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2247,8 +2136,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
/* set it to true so that op does not emit cond signals for all notifications
from the backend */
our_op->bool = TRUE;
@@ -2261,7 +2148,6 @@
GNOME_Evolution_Calendar_Cal_isReadOnly (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2273,9 +2159,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
@@ -2283,7 +2167,6 @@
*read_only = our_op->bool;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
}
@@ -2326,8 +2209,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
@@ -2336,7 +2217,6 @@
GNOME_Evolution_Calendar_Cal_getCalAddress (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2348,14 +2228,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*cal_address = our_op->string;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2403,8 +2280,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
@@ -2413,7 +2288,6 @@
GNOME_Evolution_Calendar_Cal_getAlarmEmailAddress (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2425,15 +2299,12 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*alarm_address = our_op->string;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2476,8 +2347,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
@@ -2486,7 +2355,6 @@
GNOME_Evolution_Calendar_Cal_getLdapAttribute (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2498,15 +2366,12 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*ldap_attribute = our_op->string;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2539,8 +2404,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
@@ -2549,7 +2412,6 @@
GNOME_Evolution_Calendar_Cal_getStaticCapabilities (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2561,15 +2423,12 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
priv->capabilities = our_op->string;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2778,8 +2637,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -2787,7 +2644,6 @@
GNOME_Evolution_Calendar_Cal_getDefaultObject (priv->cal, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2799,9 +2655,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
if (status != E_CALENDAR_STATUS_OK) {
@@ -2814,7 +2668,6 @@
g_free (our_op->string);
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2859,15 +2712,12 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Cal_getAttachmentList (priv->cal, uid, rid ? rid : "", &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2879,9 +2729,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
if (status != E_CALENDAR_STATUS_OK){
@@ -2891,7 +2739,6 @@
}
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -2936,8 +2783,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -2945,7 +2790,6 @@
GNOME_Evolution_Calendar_Cal_getObject (priv->cal, uid, rid ? rid : "", &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -2957,9 +2801,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
if (status != E_CALENDAR_STATUS_OK){
@@ -3007,7 +2849,6 @@
g_free (our_op->string);
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -3053,8 +2894,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -3062,7 +2901,6 @@
GNOME_Evolution_Calendar_Cal_getObject (priv->cal, uid, "", &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -3074,9 +2912,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
if (status != E_CALENDAR_STATUS_OK){
@@ -3134,7 +2970,6 @@
g_free (our_op->string);
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -3204,8 +3039,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -3214,7 +3047,6 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -3226,15 +3058,12 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*changes = our_op->list;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -3304,8 +3133,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -3314,7 +3141,6 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -3326,15 +3152,12 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*objects = our_op->list;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -3437,8 +3260,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
/* create the CORBA user list to be passed to the backend */
@@ -3458,7 +3279,6 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -3470,15 +3290,12 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*freebusy = our_op->list;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4169,8 +3986,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
e_cal_component_get_uid (comp, &uid);
@@ -4180,7 +3995,6 @@
GNOME_Evolution_Calendar_Cal_discardAlarm (priv->cal, uid, auid, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4192,14 +4006,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4415,8 +4226,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -4424,7 +4233,6 @@
GNOME_Evolution_Calendar_Cal_createObject (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4436,16 +4244,13 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
if (uid)
*uid = our_op->uid;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4495,8 +4300,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -4504,7 +4307,6 @@
GNOME_Evolution_Calendar_Cal_modifyObject (priv->cal, icalcomponent_as_ical_string (icalcomp), mod, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4516,14 +4318,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4576,8 +4375,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
@@ -4586,7 +4383,6 @@
GNOME_Evolution_Calendar_Cal_removeObject (priv->cal, uid, rid ? rid : "", mod, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4598,14 +4394,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4670,8 +4463,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -4679,7 +4470,6 @@
GNOME_Evolution_Calendar_Cal_receiveObjects (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4691,14 +4481,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4744,8 +4531,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -4753,7 +4538,6 @@
GNOME_Evolution_Calendar_Cal_sendObjects (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4765,9 +4549,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*users = our_op->list;
@@ -4788,7 +4570,6 @@
g_free (our_op->string);
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4833,8 +4614,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (priv->mutex);
/* Check for well known zones and in the cache */
@@ -4843,7 +4622,6 @@
/* If tzid is NULL or "" we return NULL, since it is a 'local time'. */
if (!tzid || !tzid[0]) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
*zone = NULL;
@@ -4861,7 +4639,6 @@
if (*zone) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
@@ -4873,7 +4650,6 @@
GNOME_Evolution_Calendar_Cal_getTimezone (priv->cal, tzid, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -4885,9 +4661,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
if (status != E_CALENDAR_STATUS_OK){
@@ -4901,7 +4675,6 @@
if (!icalcomp) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4912,7 +4685,6 @@
icaltimezone_free (*zone, 1);
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OBJECT_NOT_FOUND, error);
@@ -4922,7 +4694,6 @@
g_hash_table_insert (priv->timezones, icaltimezone_get_tzid (*zone), *zone);
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -4967,15 +4738,12 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (priv->mutex);
/* Make sure we have a valid component - UTC doesn't, nor do
* we really have to add it */
if (izone == icaltimezone_get_utc_timezone ()) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
@@ -4984,7 +4752,6 @@
icalcomp = icaltimezone_get_component (izone);
if (!icalcomp) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_INVALID_ARG, error);
@@ -4999,7 +4766,6 @@
GNOME_Evolution_Calendar_Cal_addTimezone (priv->cal, tzobj, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -5011,14 +4777,11 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -5060,8 +4823,6 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (ecal->priv->mutex);
CORBA_exception_init (&ev);
@@ -5071,7 +4832,6 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -5083,9 +4843,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
*query = our_op->query;
@@ -5093,7 +4851,6 @@
bonobo_object_unref (BONOBO_OBJECT (our_op->listener));
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);
@@ -5174,15 +4931,12 @@
our_op = e_calendar_new_op (ecal);
- g_mutex_lock (our_op->mutex);
-
g_mutex_unlock (priv->mutex);
/* FIXME Adding it to the server to change the tzid */
icalcomp = icaltimezone_get_component (zone);
if (!icalcomp) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_INVALID_ARG, error);
@@ -5197,7 +4951,6 @@
GNOME_Evolution_Calendar_Cal_setDefaultTimezone (priv->cal, tzobj, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
CORBA_exception_free (&ev);
@@ -5209,9 +4962,7 @@
CORBA_exception_free (&ev);
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- g_cond_wait (our_op->cond, our_op->mutex);
+ e_flag_wait (our_op->done);
status = our_op->status;
@@ -5223,7 +4974,6 @@
}
e_calendar_remove_op (ecal, our_op);
- g_mutex_unlock (our_op->mutex);
e_calendar_free_op (our_op);
E_CALENDAR_CHECK_STATUS (status, error);