summaryrefslogtreecommitdiff
path: root/src/threads
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-06-05 04:23:52 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-06-05 04:23:52 +0200
commitbec5f87053759705fb77bae1aa378f2666c7d153 (patch)
treebd955b9777aa39b207fa161edf19a6609f822909 /src/threads
parent1c99a41a296cda6647edc32437a813f6923cb1d0 (diff)
parent4e10e30c2f99d552239871aa1b27a08a6c18f1a4 (diff)
Merge tag 'upstream/0.23.1'
Upstream version 0.23.1
Diffstat (limited to 'src/threads')
-rw-r--r--src/threads/BackgroundJob.vala2
-rw-r--r--src/threads/Semaphore.vala2
-rw-r--r--src/threads/Threads.vala2
-rw-r--r--src/threads/Workers.vala14
4 files changed, 10 insertions, 10 deletions
diff --git a/src/threads/BackgroundJob.vala b/src/threads/BackgroundJob.vala
index 8203307..2188425 100644
--- a/src/threads/BackgroundJob.vala
+++ b/src/threads/BackgroundJob.vala
@@ -1,4 +1,4 @@
-/* Copyright 2011-2015 Yorba Foundation
+/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU LGPL (version 2.1 or later).
* See the COPYING file in this distribution.
diff --git a/src/threads/Semaphore.vala b/src/threads/Semaphore.vala
index 31d2b2d..05b1f13 100644
--- a/src/threads/Semaphore.vala
+++ b/src/threads/Semaphore.vala
@@ -1,4 +1,4 @@
-/* Copyright 2011-2015 Yorba Foundation
+/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU LGPL (version 2.1 or later).
* See the COPYING file in this distribution.
diff --git a/src/threads/Threads.vala b/src/threads/Threads.vala
index b9bcd55..1a648d0 100644
--- a/src/threads/Threads.vala
+++ b/src/threads/Threads.vala
@@ -1,4 +1,4 @@
-/* Copyright 2011-2015 Yorba Foundation
+/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
diff --git a/src/threads/Workers.vala b/src/threads/Workers.vala
index a97b557..60751a9 100644
--- a/src/threads/Workers.vala
+++ b/src/threads/Workers.vala
@@ -1,4 +1,4 @@
-/* Copyright 2009-2015 Yorba Foundation
+/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU LGPL (version 2.1 or later).
* See the COPYING file in this distribution.
@@ -20,7 +20,7 @@ public class Workers {
private EventSemaphore empty_event = new EventSemaphore();
private int enqueued = 0;
- public Workers(int max_threads, bool exclusive) {
+ public Workers(uint max_threads, bool exclusive) {
if (max_threads <= 0 && max_threads != UNLIMITED_THREADS)
max_threads = 1;
@@ -28,22 +28,22 @@ public class Workers {
empty_event.notify();
try {
- thread_pool = new ThreadPool<void *>.with_owned_data(thread_start, max_threads, exclusive);
+ thread_pool = new ThreadPool<void *>.with_owned_data(thread_start, (int) max_threads, exclusive);
} catch (ThreadError err) {
error("Unable to create thread pool: %s", err.message);
}
}
- public static int threads_per_cpu(int per = 1, int max = -1) requires (per > 0) ensures (result > 0) {
- int count = number_of_processors() * per;
+ public static uint threads_per_cpu(int per = 1, int max = -1) requires (per > 0) ensures (result > 0) {
+ var count = GLib.get_num_processors() * per;
return (max < 0) ? count : count.clamp(0, max);
}
// This is useful when the intent is for the worker threads to use all the CPUs minus one for
// the main/UI thread. (No guarantees, of course.)
- public static int thread_per_cpu_minus_one() ensures (result > 0) {
- return (number_of_processors() - 1).clamp(1, int.MAX);
+ public static uint thread_per_cpu_minus_one() ensures (result > 0) {
+ return (GLib.get_num_processors() - 1).clamp(1, int.MAX);
}
// Enqueues a BackgroundJob for work in a thread context. BackgroundJob.execute() is called