From 5ef14553c1129aaaf1691c14219a5bcce29bf64f Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 24 Jul 2001 00:56:11 +0000 Subject: Added some warnings for bad cases. 2001-07-24 Not Zed * camel-operation.c (camel_operation_register, unregister): Added some warnings for bad cases. 2001-07-23 Not Zed * camel-operation.c (camel_operation_register): Only insert a hash entry if we haven't already. (camel_operation_unregister): Only remove the has entry if the id is a real thread. svn path=/trunk/; revision=11329 --- camel/ChangeLog | 12 ++++++++++++ camel/camel-operation.c | 18 ++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 63601069f2..4ababadcf5 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,15 @@ +2001-07-24 Not Zed + + * camel-operation.c (camel_operation_register, unregister): Added + some warnings for bad cases. + +2001-07-23 Not Zed + + * camel-operation.c (camel_operation_register): Only insert a hash + entry if we haven't already. + (camel_operation_unregister): Only remove the has entry if the id + is a real thread. + 2001-07-23 Jeffrey Stedfast * camel-filter-driver.c (do_move): Slight fix for when source == diff --git a/camel/camel-operation.c b/camel/camel-operation.c index 0b5678d29a..dce3340b9a 100644 --- a/camel/camel-operation.c +++ b/camel/camel-operation.c @@ -291,8 +291,12 @@ void camel_operation_register(CamelOperation *cc) } } - cc->id = id; - g_hash_table_insert(operation_active, (void *)id, cc); + if (cc->id == (~0)) { + cc->id = id; + g_hash_table_insert(operation_active, (void *)id, cc); + } else { + g_warning("Re-registering thread %d for cancellation as thread %d", cc->id, id); + } d(printf("registering thread %ld for cancellation\n", id)); @@ -322,8 +326,14 @@ void camel_operation_unregister(CamelOperation *cc) } } - if (cc) - g_hash_table_remove(operation_active, (void *)cc->id); + if (cc) { + if (cc->id != (~0)) { + g_hash_table_remove(operation_active, (void *)cc->id); + cc->id == ~0; + } else { + g_warning("Unregistering an operation that was already unregistered"); + } + } CAMEL_ACTIVE_UNLOCK(); -- cgit v1.2.3