aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-object.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-01-13 19:56:12 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-01-13 19:56:12 +0800
commit5147fa21587e0cb2f28c1b5316cb0ca392f3c622 (patch)
tree4d522d66e58b183f653274fc430f40c049a28275 /camel/camel-object.c
parentcf4448abf4112f6d2edb780fe6b1edf27ad7ea82 (diff)
downloadgsoc2013-evolution-5147fa21587e0cb2f28c1b5316cb0ca392f3c622.tar.gz
gsoc2013-evolution-5147fa21587e0cb2f28c1b5316cb0ca392f3c622.tar.zst
gsoc2013-evolution-5147fa21587e0cb2f28c1b5316cb0ca392f3c622.zip
fix header include order.
2003-01-13 Not Zed <NotZed@Ximian.com> * camel-mime-filter-tohtml.c: fix header include order. * camel-object.c (camel_object_bag_reserve): Add an assert to check we're not trying to reserve the bag more than once in a given thread. (camel_object_bag_list): If we have reserved the bag, dont try and cond wait. Fixes a deadlock. svn path=/trunk/; revision=19424
Diffstat (limited to 'camel/camel-object.c')
-rw-r--r--camel/camel-object.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/camel/camel-object.c b/camel/camel-object.c
index 7214518839..b2cf6ffea5 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -1212,6 +1212,7 @@ void *camel_object_bag_reserve(CamelObjectBag *bag, const char *key)
/* NOTE: We dont actually reserve the key, we just reserve
the whole bag. We could do either but this is easier */
if (bag->flags & CAMEL_OBJECT_BAG_RESERVED) {
+ g_assert(bag->owner != pthread_self());
e_mutex_cond_wait(&bag->cond, type_lock);
retry = TRUE;
} else {
@@ -1265,8 +1266,11 @@ GPtrArray *camel_object_bag_list(CamelObjectBag *bag)
list = g_ptr_array_new();
E_LOCK(type_lock);
- while (bag->flags & CAMEL_OBJECT_BAG_RESERVED)
- e_mutex_cond_wait(&bag->cond, type_lock);
+ if (bag->flags & CAMEL_OBJECT_BAG_RESERVED
+ && (bag->owner != pthread_self())) {
+ while (bag->flags & CAMEL_OBJECT_BAG_RESERVED)
+ e_mutex_cond_wait(&bag->cond, type_lock);
+ }
g_hash_table_foreach(bag->object_table, (GHFunc)save_bag, list);
E_UNLOCK(type_lock);