summaryrefslogtreecommitdiff
path: root/src/job-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/job-manager.c')
-rw-r--r--src/job-manager.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/job-manager.c b/src/job-manager.c
index 8044b7f..fd41550 100644
--- a/src/job-manager.c
+++ b/src/job-manager.c
@@ -370,7 +370,11 @@ build_tree (TGallerySetup *setup,
for (i = 0; i < jobs; i++) {
error = NULL;
+#ifdef HAVE_GLIB_NEW_THREADS
+ thread = g_thread_try_new (NULL, thread_func, job, &error);
+#else
thread = g_thread_create (thread_func, job, TRUE, &error);
+#endif
if (thread)
thread_list = g_list_append (thread_list, thread);
if (error) {
@@ -381,9 +385,9 @@ build_tree (TGallerySetup *setup,
/* wait for threads are finished */
for (l = thread_list; l != NULL; l = l->next) {
+ /* also unrefs the thread instance */
g_thread_join (l->data);
}
- /* TODO: free threads? */
g_list_free (thread_list);
#else /* threads are disabled */