aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-op-queue.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-10-14 05:16:55 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-10-14 05:16:55 +0800
commitbf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b (patch)
tree056d9ba033cc1559f9f2f853031bde4d5d2c4a29 /camel/camel-op-queue.c
parent7c604052f5ab4824264a9630b7a18aa04d76d5a6 (diff)
downloadgsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.tar
gsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.tar.gz
gsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.tar.bz2
gsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.tar.lz
gsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.tar.xz
gsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.tar.zst
gsoc2013-evolution-bf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b.zip
A lot of changes. The thread proxy mechanism
is now functional. The signal proxy needs to be tested though. The thread proxy folder is being implemented. A rough summary : 1999-10-13 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-folder.c (camel_folder_close): the folder->close method is now asynchronous. * camel/camel-folder-pt-proxy.c (_folder_open_cb): (_open): (_folder_open_cb): (_open): open/close method implemented in the thread proxy folder. More to come. * camel/camel-exception.c (camel_exception_xfer): new utility func. * camel/camel-marshal-utils.c: some new marshallers * camel/camel-folder-pt-proxy.c: Some explanations on the thread proxy system. 1999-10-11 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-marshal-utils.c: camel/camel-marshal-utils.h: Handles operation marshalling. * camel/camel-thread-proxy.c: camel/camel-thread-proxy.h: new files. Generic proxy system. * camel/camel-folder-pt-proxy.c moved all proxy related code in dedicated files. (camel_folder_pt_proxy_init): removed proxy initialisation code (_finalize): removed proxy finalization code * camel/camel-exception.c (camel_exception_new): (camel_exception_set): (camel_exception_free): New funcs. svn path=/trunk/; revision=1328
Diffstat (limited to 'camel/camel-op-queue.c')
-rw-r--r--camel/camel-op-queue.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/camel/camel-op-queue.c b/camel/camel-op-queue.c
index a722c16f80..415c607859 100644
--- a/camel/camel-op-queue.c
+++ b/camel/camel-op-queue.c
@@ -22,7 +22,9 @@
/* MT safe */
-
+
+#include <config.h>
+#include "camel-log.h"
#include "camel-op-queue.h"
static GStaticMutex op_queue_mutex = G_STATIC_MUTEX_INIT;
@@ -41,14 +43,27 @@ camel_op_queue_new ()
{
CamelOpQueue *op_queue;
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::new\n");
op_queue = g_new (CamelOpQueue, 1);
op_queue->ops_tail = NULL;
op_queue->ops_head = NULL;
-
+ op_queue->service_available = TRUE;
+
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::new\n");
+ return op_queue;
}
+void
+camel_op_queue_free (CamelOpQueue *op_queue)
+{
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::free\n");
+ g_list_free (op_queue->ops_head);
+ g_free (op_queue);
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::free\n");
+}
+
/**
* camel_op_queue_push_op: Add an operation to the queue
* @queue: queue object
@@ -62,14 +77,18 @@ camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op)
{
GList *new_op;
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::push_op\n");
g_assert (queue);
g_static_mutex_lock (&op_queue_mutex);
if (!queue->ops_tail) {
+ CAMEL_LOG_FULL_DEBUG ("CamelOpQueue::push_op queue does not exists yet. "
+ "Creating it\n");
queue->ops_head = g_list_prepend (NULL, op);
queue->ops_tail = queue->ops_head;
} else
queue->ops_head = g_list_prepend (queue->ops_head, op);
g_static_mutex_unlock (&op_queue_mutex);
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::push_op\n");
}
@@ -87,14 +106,18 @@ camel_op_queue_pop_op (CamelOpQueue *queue)
GList *op_list;
CamelOp *op;
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::pop_op\n");
g_assert (queue);
g_static_mutex_lock (&op_queue_mutex);
op_list = queue->ops_tail;
+ if (!op_list) return NULL;
+
queue->ops_tail = queue->ops_tail->prev;
op = (CamelOp *)op_list->data;
g_static_mutex_unlock (&op_queue_mutex);
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::pop_op\n");
return op;
}
@@ -112,11 +135,12 @@ camel_op_queue_run_next_op (CamelOpQueue *queue)
{
CamelOp *op;
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::run_next_op\n");
op = camel_op_queue_pop_op (queue);
if (!op) return FALSE;
-
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::run_next_op\n");
return FALSE;
}
@@ -130,9 +154,11 @@ camel_op_queue_run_next_op (CamelOpQueue *queue)
void
camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available)
{
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::set_service_availability\n");
g_static_mutex_lock (&op_queue_mutex);
queue->service_available = available;
g_static_mutex_unlock (&op_queue_mutex);
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::set_service_availability\n");
}
/**
@@ -147,9 +173,12 @@ gboolean
camel_op_queue_get_service_availability (CamelOpQueue *queue)
{
gboolean available;
+
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::get_service_availability\n");
g_static_mutex_lock (&op_queue_mutex);
available = queue->service_available;
g_static_mutex_unlock (&op_queue_mutex);
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::get_service_availability\n");
return available;
}