diff options
author | Not Zed <NotZed@Ximian.com> | 2004-03-29 14:29:43 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-03-29 14:29:43 +0800 |
commit | 07de64a309717703ac6bbb6845f5b2d31372d6f7 (patch) | |
tree | b7ede2c0126c876f1810ee472836af7ebd6ebf73 /camel/camel-object.c | |
parent | fa9c9db0a6b3281b62b2fd38c536872df4206c60 (diff) | |
download | gsoc2013-evolution-07de64a309717703ac6bbb6845f5b2d31372d6f7.tar.gz gsoc2013-evolution-07de64a309717703ac6bbb6845f5b2d31372d6f7.tar.zst gsoc2013-evolution-07de64a309717703ac6bbb6845f5b2d31372d6f7.zip |
use object_bag_peek instead of _get, since we dont want to clash/wait for
2004-03-29 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-store.c (get_folder_counts): use
object_bag_peek instead of _get, since we dont want to clash/wait
for reservations. More #56045 related fixes.
(get_folder_counts): revert the lookup/hashtable stuff for the
folder, and use object_bag_peek.
* camel-object.c (camel_object_bag_peek): new method to get an
object bag entry without worrying about if its reserved or not.
svn path=/trunk/; revision=25220
Diffstat (limited to 'camel/camel-object.c')
-rw-r--r-- | camel/camel-object.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/camel/camel-object.c b/camel/camel-object.c index 4875774652..f4469f8d9d 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -1812,6 +1812,38 @@ camel_object_bag_get(CamelObjectBag *bag, const void *key) } /** + * camel_object_bag_peek: + * @bag: + * @key: + * + * Lookup the object @key in @bag, ignoring any reservations. If it + * isn't committed, then it isn't considered. This should only be + * used where reliable transactional-based state is not required. + * + * Unlike other 'peek' operations, the object is still reffed if + * found. + * + * Return value: A referenced object, or NULL if @key is not + * present in the bag. + **/ +void * +camel_object_bag_peek(CamelObjectBag *bag, const void *key) +{ + CamelObject *o; + + E_LOCK(type_lock); + + o = g_hash_table_lookup(bag->object_table, key); + if (o) { + /* we use the same lock as the refcount */ + o->ref_count++; + } + E_UNLOCK(type_lock); + + return o; +} + +/** * camel_object_bag_reserve: * @bag: * @key: |