summaryrefslogtreecommitdiff
path: root/libzeitgeist
diff options
context:
space:
mode:
authorSeif Lotfy <seif@lotfy.com>2013-02-27 17:57:56 +0100
committerSeif Lotfy <seif@lotfy.com>2013-02-27 17:57:56 +0100
commitb72ded1aaf3a5bdae2d97d4d52acb8f40cd7e21e (patch)
treee8ff5f01b641c5a037e8ba9379c8da7596e82597 /libzeitgeist
parent97960778db10499b615b456f31e5d635c588264e (diff)
downloadzeitgeist-b72ded1aaf3a5bdae2d97d4d52acb8f40cd7e21e.tar.gz
Handle threadpool error properly
Diffstat (limited to 'libzeitgeist')
-rw-r--r--libzeitgeist/log.vala24
1 files changed, 15 insertions, 9 deletions
diff --git a/libzeitgeist/log.vala b/libzeitgeist/log.vala
index c667ff5c..e67cfeed 100644
--- a/libzeitgeist/log.vala
+++ b/libzeitgeist/log.vala
@@ -80,12 +80,17 @@ public class Log : QueuedProxyWrapper
private DbReader dbreader;
private ThreadPool<void*> threads;
- public Log () throws EngineError, ThreadError
+ public Log ()
{
monitors = new HashTable<Monitor, int>(direct_hash, direct_equal);
- threads = new ThreadPool<DbWorker>.with_owned_data((worker) => {
- worker.run ();
- }, get_nprocs_conf (), true);
+ try {
+ threads = new ThreadPool<DbWorker>.with_owned_data((worker) => {
+ worker.run ();
+ }, get_nprocs_conf (), true);
+ } catch (ThreadError err) {
+ warning("%s\n", err.message);
+ }
+
MainLoop mainloop = new MainLoop();
Bus.get_proxy.begin<RemoteLog> (BusType.SESSION, Utils.ENGINE_DBUS_NAME,
@@ -136,7 +141,8 @@ public class Log : QueuedProxyWrapper
warn_if_fail (engine_version.get_type_string () == "(iii)");
if (proxy.datapath != null && proxy.datapath != ":memory:" &&
- FileUtils.test (proxy.datapath, GLib.FileTest.EXISTS)) {
+ FileUtils.test (proxy.datapath, GLib.FileTest.EXISTS) &&
+ threads != null) {
Utils.set_database_file_path (proxy.datapath);
try {
dbreader = new DbReader ();
@@ -271,7 +277,7 @@ public class Log : QueuedProxyWrapper
result_set = new SimpleResultSet (result);
Idle.add ((owned) callback);
} catch (EngineError err) {
- stdout.printf("%s\n", err.message);
+ warning("%s\n", err.message);
}
return null;
};
@@ -328,7 +334,7 @@ public class Log : QueuedProxyWrapper
storage_state, num_events, result_type);
Idle.add ((owned) callback);
} catch (EngineError err) {
- stdout.printf("%s\n", err.message);
+ warning("%s\n", err.message);
}
return null;
};
@@ -380,7 +386,7 @@ public class Log : QueuedProxyWrapper
result_set = new SimpleResultSet (result);
Idle.add ((owned) callback);
} catch (EngineError err) {
- stdout.printf("%s\n", err.message);
+ warning("%s\n", err.message);
}
return null;
};
@@ -427,7 +433,7 @@ public class Log : QueuedProxyWrapper
result_event_templates, storage_state, num_events, result_type);
Idle.add ((owned) callback);
} catch (EngineError err) {
- stdout.printf("%s\n", err.message);
+ warning("%s\n", err.message);
}
return null;
};