diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-09-18 07:40:06 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-09-18 07:40:06 +0800 |
commit | 445b09502f6aabb6359c18acb188e92e97da31f7 (patch) | |
tree | 47ead377e2f198570cd4819f3052a1d78d1ffc9a /camel/camel-folder-pt-proxy.c | |
parent | acd6bafa58cf5fdea4814e51aac175a99894a373 (diff) | |
download | gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.tar gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.tar.gz gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.tar.bz2 gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.tar.lz gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.tar.xz gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.tar.zst gsoc2013-evolution-445b09502f6aabb6359c18acb188e92e97da31f7.zip |
new func. Try to exec an operation in a thread or queue it if a thread is
1999-09-18 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-folder-pt-proxy.c (_op_exec_or_plan_for_exec):
new func. Try to exec an operation in a thread
or queue it if a thread is already busy.
* camel/camel-op-queue.c (camel_op_queue_set_service_availability):
(camel_op_queue_get_service_availability):
new funcs.
* camel/camel-op-queue.c (camel_op_new):
(camel_op_free):
new funcs. Uses glib mem chunks.
svn path=/trunk/; revision=1237
Diffstat (limited to 'camel/camel-folder-pt-proxy.c')
-rw-r--r-- | camel/camel-folder-pt-proxy.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c index d8031fb398..b87f19382d 100644 --- a/camel/camel-folder-pt-proxy.c +++ b/camel/camel-folder-pt-proxy.c @@ -138,8 +138,6 @@ 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 (); } @@ -187,9 +185,17 @@ _finalize (GtkObject *object) static void -_plan_op_for_exec (CamelOp *op) +_op_exec_or_plan_for_exec (CamelFolderPtProxy *proxy_folder, CamelOp *op) { - + CamelOpQueue *op_queue; + pthread_t thread; + + op_queue = proxy_folder->op_queue; + + if (op_queue->service_available) { + op_queue->service_available = FALSE; + pthread_create (&thread, NULL , (thread_call_func)(op->func), op->param); + } } @@ -229,6 +235,7 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store) _InitStoreParam *param; pthread_t init_store_thread; int filedes[2]; + CamelOp *op; #warning Notify io_channel initialization should be elsewhere /* it can not be in camel_folder_proxy_init @@ -244,18 +251,17 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store) 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]); - + + op = camel_op_new (); /* param will be freed in _async_init_with_store */ param = g_new (_InitStoreParam, 1); param->folder = folder; param->parent_store = parent_store; - /* - * call _async_init_with_store in a separate thread - * the thread may block on a mutex, but not the main - * thread. - */ - pthread_create (&init_store_thread, NULL , (thread_call_func)_async_init_with_store, param); + op->func = async_init_with_store; + op->param = param; + + } |