aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test8.c
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-10-14 05:18:21 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-10-14 05:18:21 +0800
commitb2d31595932e80930e6bd532bb81d2e7e40e09f2 (patch)
tree73c6da7a380cd6cf75a68a824d1a2bfcd3e66008 /tests/test8.c
parentbf9f54f9615c1b7b5c8ce5c434d0f78a99f5845b (diff)
downloadgsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.tar
gsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.tar.gz
gsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.tar.bz2
gsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.tar.lz
gsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.tar.xz
gsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.tar.zst
gsoc2013-evolution-b2d31595932e80930e6bd532bb81d2e7e40e09f2.zip
missing files
svn path=/trunk/; revision=1329
Diffstat (limited to 'tests/test8.c')
-rw-r--r--tests/test8.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/test8.c b/tests/test8.c
new file mode 100644
index 0000000000..1f446e171d
--- /dev/null
+++ b/tests/test8.c
@@ -0,0 +1,78 @@
+/* test posix thread folder proxy */
+
+
+#include "camel.h"
+#include "camel-log.h"
+
+CamelThreadProxy *proxy;
+CamelFuncDef *func_def;
+
+
+void
+test_sync_func (int num)
+{
+ printf ("Sync function number %d\n", num);
+ printf ("Sync function : current thread : %d\n", pthread_self ());
+
+}
+
+
+void
+test_async_cb (int num)
+{
+ printf ("Callback number %d\n", num);
+ printf ("Callback : current thread : %d\n", pthread_self ());
+}
+
+void
+test_async_func (int num)
+{
+ CamelOp *cb;
+
+ printf ("Async function number %d\n", num);
+ printf ("Async function : current thread : %d\n", pthread_self ());
+ sleep (1);
+ cb = camel_marshal_create_op (func_def, test_async_cb, num);
+ camel_thread_proxy_push_cb (proxy, cb);
+
+
+}
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ CamelOp *op;
+
+ camel_debug_level = CAMEL_LOG_LEVEL_WARNING;
+
+ camel_init ();
+
+ func_def =
+ camel_func_def_new (camel_marshal_NONE__INT,
+ 1,
+ GTK_TYPE_INT);
+
+ printf ("--== Testing Simple marshalling system ==--\n");
+ for (i=0; i<5; i++) {
+ printf ("Iterration number %d\n", i);
+ op = camel_marshal_create_op (func_def, test_sync_func, i);
+ camel_op_run (op);
+ camel_op_free (op);
+
+ }
+ printf ("\n\n");
+
+ proxy = camel_thread_proxy_new ();
+
+ printf ("--== Testing Asynchronous Operation System ==--\n");
+ for (i=0; i<5; i++) {
+ printf ("Pushing async operation number %d for execution\n", i);
+ op = camel_marshal_create_op (func_def, test_async_func, i);
+ camel_thread_proxy_push_op (proxy, op);
+ }
+ printf ("\n\n");
+ printf ("--== Operations execution planned ==--\n");
+ gtk_main ();
+}
+