aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
author0 <NotZed@Ximian.com>2001-10-31 02:52:00 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-31 02:52:00 +0800
commit3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846 (patch)
tree48ca7ba7989672477e8c3ec70020200b26cc768a /camel
parentaa4d57d3e41023f2e88571135275f20cdd3dc4e7 (diff)
downloadgsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.tar
gsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.tar.gz
gsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.tar.bz2
gsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.tar.lz
gsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.tar.xz
gsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.tar.zst
gsoc2013-evolution-3afcc4239f9fde2ba8adbfa2ea6dcfc72509c846.zip
Dont setup cancel_fd. (camel_operation_cancel_fd): If cancel_fd not
2001-10-30 <NotZed@Ximian.com> * camel-operation.c (camel_operation_new): Dont setup cancel_fd. (camel_operation_cancel_fd): If cancel_fd not created, set it up. (camel_operation_cancel): Set cancel flag before sending message. (cancel_thread): Same. svn path=/trunk/; revision=14469
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-operation.c21
2 files changed, 18 insertions, 8 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 3d7db779d8..d8ba0bc968 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,10 @@
2001-10-30 <NotZed@Ximian.com>
+ * camel-operation.c (camel_operation_new): Dont setup cancel_fd.
+ (camel_operation_cancel_fd): If cancel_fd not created, set it up.
+ (camel_operation_cancel): Set cancel flag before sending message.
+ (cancel_thread): Same.
+
* camel-filter-driver.c (camel_filter_driver_filter_mbox): Make
sure we unref the mimeparse when we're done (successfully). This
was leaking an fd every get-mail! :(
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index 9f007d79f6..6c490df73f 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -95,7 +95,7 @@ CamelOperation *camel_operation_new(CamelOperationStatusFunc status, void *statu
#ifdef ENABLE_THREADS
cc->id = ~0;
cc->cancel_port = e_msgport_new();
- cc->cancel_fd = e_msgport_fd(cc->cancel_port);
+ cc->cancel_fd = -1;
#endif
return cc;
@@ -256,9 +256,9 @@ cancel_thread(void *key, CamelOperation *cc, void *data)
if (cc) {
d(printf("cancelling thread %d\n", cc->id));
+ cc->flags |= CAMEL_OPERATION_CANCELLED;
msg = g_malloc0(sizeof(*msg));
e_msgport_put(cc->cancel_port, (EMsg *)msg);
- cc->flags |= CAMEL_OPERATION_CANCELLED;
}
}
@@ -282,9 +282,9 @@ void camel_operation_cancel(CamelOperation *cc)
} else if ((cc->flags & CAMEL_OPERATION_CANCELLED) == 0) {
d(printf("cancelling thread %d\n", cc->id));
+ cc->flags |= CAMEL_OPERATION_CANCELLED;
msg = g_malloc0(sizeof(*msg));
e_msgport_put(cc->cancel_port, (EMsg *)msg);
- cc->flags |= CAMEL_OPERATION_CANCELLED;
}
CAMEL_ACTIVE_UNLOCK();
@@ -416,17 +416,22 @@ gboolean camel_operation_cancel_check(CamelOperation *cc)
**/
int camel_operation_cancel_fd(CamelOperation *cc)
{
+ CAMEL_ACTIVE_LOCK();
+
if (cc == NULL && operation_active) {
- CAMEL_ACTIVE_LOCK();
cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
}
- if (cc == NULL)
+ if (cc == NULL
+ || cc->blocked) {
+ CAMEL_ACTIVE_UNLOCK();
return -1;
+ }
- if (cc->blocked)
- return -1;
+ if (cc->cancel_fd == -1)
+ cc->cancel_fd = e_msgport_fd(cc->cancel_port);
+
+ CAMEL_ACTIVE_UNLOCK();
return cc->cancel_fd;
}