#include #include "executor.h" G_LOCK_DEFINE (blah); GList *list; static void the_job (gpointer data) { int i; G_LOCK (blah); for (i = 0; i < 34540; ++i) ; #if 0 g_print ("%d he string is: %p\n", (GPOINTER_TO_INT (data)), g_thread_self()); #endif list = g_list_prepend (list, data); G_UNLOCK (blah); } int main () { Executor *exe = executor_new (4); int i; for (i = 0; i < 200000; ++i) { executor_add_job (exe, the_job, i * 10 + 0); executor_add_job (exe, the_job, i * 10 + 1); executor_add_job (exe, the_job, i * 10 + 2); executor_add_job (exe, the_job, i * 10 + 3); executor_add_job (exe, the_job, i * 10 + 4); executor_add_job (exe, the_job, i * 10 + 5); executor_add_job (exe, the_job, i * 10 + 6); executor_add_job (exe, the_job, i * 10 + 7); executor_add_job (exe, the_job, i * 10 + 8); executor_add_job (exe, the_job, i * 10 + 9); } executor_sync (exe); executor_free (exe); g_print ("%d\n", g_list_length (list)); }