aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--camel/camel-folder-pt-proxy.c36
-rw-r--r--camel/camel-folder-pt-proxy.h6
-rw-r--r--camel/camel-op-queue.c23
-rw-r--r--camel/camel-op-queue.h1
5 files changed, 70 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e01f51abd0..5a6d24a6cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,15 @@
1999-09-17 bertrand <Bertrand.Guiheneuf@aful.org>
+ * camel/camel-folder-pt-proxy.c (_init_with_store):
+ added notify io_channel.
+
* camel/camel-op-queue.h:
* camel/camel-op-queue.c:
New object. Operation queue. Meant to be used in
non-blocking proxy objects.
-
+ (camel_op_queue_run_next_op): new func.
+ run the next operation.
+
1999-09-14 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/Makefile.am (libcamel_la_SOURCES):
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c
index 0d7bc3c957..d8031fb398 100644
--- a/camel/camel-folder-pt-proxy.c
+++ b/camel/camel-folder-pt-proxy.c
@@ -44,6 +44,9 @@
#include "camel-folder-pt-proxy.h"
#include "camel-log.h"
#include <pthread.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
/* needed for proper casts of async funcs when
* calling pthreads_create
@@ -132,6 +135,14 @@ camel_folder_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy_cl
+static void
+camel_folder_proxy_init (CamelFolderPtProxy *folder_pt_proxy)
+{
+
+
+ folder_pt_proxy->op_queue = camel_op_queue_new ();
+
+}
@@ -147,7 +158,7 @@ camel_folder_proxy_get_type (void)
sizeof (CamelFolderPtProxy),
sizeof (CamelFolderPtProxyClass),
(GtkClassInitFunc) camel_folder_proxy_class_init,
- (GtkObjectInitFunc) NULL,
+ (GtkObjectInitFunc) camel_folder_proxy_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
@@ -175,6 +186,13 @@ _finalize (GtkObject *object)
+static void
+_plan_op_for_exec (CamelOp *op)
+{
+
+
+}
+
/* folder->init_with_store implementation */
@@ -210,7 +228,23 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store)
CamelFolderPtProxy *proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
_InitStoreParam *param;
pthread_t init_store_thread;
+ int filedes[2];
+
+#warning Notify io_channel initialization should be elsewhere
+ /* it can not be in camel_folder_proxy_init
+ * because of the pipe error handling */
+ /* set up the notification channel */
+ if (!pipe (filedes)) {
+ CAMEL_LOG_WARNING ("could not create pipe in for camel_folder_proxy_init");
+ CAMEL_LOG_FULL_DEBUG ("Full error message : %s\n", strerror(errno));
+ return;
+ }
+
+ proxy_folder->pipe_client_fd = filedes [0];
+ proxy_folder->pipe_server_fd = filedes [1];
+ proxy_folder->notify_source = g_io_channel_unix_new (filedes [0]);
+
/* param will be freed in _async_init_with_store */
param = g_new (_InitStoreParam, 1);
param->folder = folder;
diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h
index e2ce27a769..9051065b08 100644
--- a/camel/camel-folder-pt-proxy.h
+++ b/camel/camel-folder-pt-proxy.h
@@ -29,6 +29,7 @@
#define CAMEL_FOLDER_PT_PROXY_H 1
#include "camel-folder.h"
+#include "camel-op-queue.h"
#define CAMEL_FOLDER_PT_PROXY_TYPE (camel_folder_pt_proxy_get_type ())
@@ -43,6 +44,11 @@ typedef struct {
CamelFolder *real_folder;
GStaticMutex mutex;
+ CamelOpQueue *op_queue;
+ gint pipe_client_fd;
+ gint pipe_server_fd;
+ GIOChannel *notify_source;
+
} CamelFolderPtProxy;
diff --git a/camel/camel-op-queue.c b/camel/camel-op-queue.c
index 5549a40de1..c58ade9958 100644
--- a/camel/camel-op-queue.c
+++ b/camel/camel-op-queue.c
@@ -83,7 +83,28 @@ camel_op_queue_pop_op (CamelOpQueue *queue)
op = queue->ops_tail;
queue->ops_tail = queue->ops_tail->prev;
- return op;
+ return (CamelOp *)op->data;
}
+/**
+ * camel_op_queue_run_next_op: run the next pending operation
+ * @queue: queue object
+ *
+ * Run the next pending operation in the queue.
+ *
+ * Return value: TRUE if an operation was launched FALSE if there was no operation pending in the queue.
+ **/
+gboolean
+camel_op_queue_run_next_op (CamelOpQueue *queue)
+{
+ CamelOp *op;
+
+ op = camel_op_queue_pop_op (queue);
+ if (!op) return FALSE;
+
+ /* run the operation */
+ op->op_func (op->param);
+
+ return FALSE;
+}
diff --git a/camel/camel-op-queue.h b/camel/camel-op-queue.h
index 34ee8249a1..e99d785b93 100644
--- a/camel/camel-op-queue.h
+++ b/camel/camel-op-queue.h
@@ -52,6 +52,7 @@ typedef struct
CamelOpQueue *camel_op_queue_new ();
void camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op);
CamelOp *camel_op_queue_pop_op (CamelOpQueue *queue);
+gboolean camel_op_queue_run_next_op (CamelOpQueue *queue);
#ifdef __cplusplus
}