[shotwell] Remove obsolete vapis
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Remove obsolete vapis
- Date: Fri, 29 Apr 2016 19:07:09 +0000 (UTC)
commit ce9c8df241f5d72af8bd829f886afceeda171030
Author: Jens Georg <mail jensge org>
Date: Thu Apr 28 21:22:06 2016 +0200
Remove obsolete vapis
- ExtendedPosix - replaced by GLib.get_num_processors()
- unique-3.0 - unused, replaced with GApplication
Signed-off-by: Jens Georg <mail jensge org>
Makefile | 4 --
src/BatchImport.vala | 2 +-
src/threads/Workers.vala | 12 +++---
src/util/system.vala | 5 --
vapi/ExtendedPosix.vapi | 18 ---------
vapi/unique-3.0.deps | 8 ----
vapi/unique-3.0.vapi | 94 ----------------------------------------------
7 files changed, 7 insertions(+), 136 deletions(-)
---
diff --git a/Makefile b/Makefile
index e0eca41..2e32f3b 100644
--- a/Makefile
+++ b/Makefile
@@ -116,15 +116,12 @@ THUMBNAILER_SRC_FILES = \
shotwell-video-thumbnailer.vala
VAPI_FILES = \
- ExtendedPosix.vapi \
LConv.vapi \
libexif.vapi \
libraw.vapi \
- unique-3.0.vapi \
unity.vapi
DEPS_FILES = \
- unique-3.0.deps \
unity.deps
ifdef WITH_GPHOTO_25
@@ -245,7 +242,6 @@ HEADER_DIRS = \
./vapi
LOCAL_PKGS = \
- ExtendedPosix \
posix \
LConv
diff --git a/src/BatchImport.vala b/src/BatchImport.vala
index 13feabe..fb48efd 100644
--- a/src/BatchImport.vala
+++ b/src/BatchImport.vala
@@ -431,7 +431,7 @@ public class BatchImport : Object {
private Gee.HashMap<string, File> imported_full_md5_table = new Gee.HashMap<string, File>();
#endif
private uint throbber_id = 0;
- private int max_outstanding_import_jobs = Workers.thread_per_cpu_minus_one();
+ private uint max_outstanding_import_jobs = Workers.thread_per_cpu_minus_one();
private bool untrash_duplicates = true;
private bool mark_duplicates_online = true;
diff --git a/src/threads/Workers.vala b/src/threads/Workers.vala
index a97b557..f48057f 100644
--- a/src/threads/Workers.vala
+++ b/src/threads/Workers.vala
@@ -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
diff --git a/src/util/system.vala b/src/util/system.vala
index 8e5a07f..59ca47e 100644
--- a/src/util/system.vala
+++ b/src/util/system.vala
@@ -4,11 +4,6 @@
* See the COPYING file in this distribution.
*/
-int number_of_processors() {
- int n = (int) ExtendedPosix.sysconf(ExtendedPosix.ConfName._SC_NPROCESSORS_ONLN);
- return n <= 0 ? 1 : n;
-}
-
// Return the directory in which Shotwell is installed, or null if uninstalled.
File? get_sys_install_dir(File exec_dir) {
// guard against exec_dir being a symlink
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]