diff options
author | Søren Sandmann <sandmann@redhat.com> | 2009-08-30 21:50:51 -0400 |
---|---|---|
committer | Søren Sandmann <sandmann@redhat.com> | 2009-08-30 21:50:51 -0400 |
commit | e947945d98e54fbd72c7764418b6556c7df7c7cc (patch) | |
tree | 88854705a9aa8b78a65f130f71ad3b1a5b89031b /test.c |
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 60 |
1 files changed, 60 insertions, 0 deletions
@@ -0,0 +1,60 @@ +#include <glib.h> +#include "jobqueue.h" + +G_LOCK_DEFINE (blah); + +GList *list; + +static void +the_job (gpointer data) +{ + int i; + +#if 0 + G_LOCK (blah); +#endif + + for (i = 0; i < 34540; ++i) + ; + +#if 0 + g_print ("%d he string is: %p\n", + (GPOINTER_TO_INT (data)), g_thread_self()); +#endif + +#if 0 + list = g_list_prepend (list, data); + + G_UNLOCK (blah); +#endif +} + +int +main () +{ + Executor *exe = executor_new (10); + int i; + + for (i = 0; i < 2000; ++i) + { + JobQueue *queue = job_queue_new (exe); + + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 0)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 1)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 2)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 3)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 4)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 5)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 6)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 7)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 8)); + job_queue_add (queue, the_job, GINT_TO_POINTER (i * 10 + 9)); + } + + executor_sync (exe); + executor_free (exe); + + g_print ("%d\n", g_list_length (list)); + + return 0; +} |