[gitg/vala] Fixed threading issues with commit model
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/vala] Fixed threading issues with commit model
- Date: Sun, 15 Apr 2012 12:58:46 +0000 (UTC)
commit 4e21da2ae9f8b5fa6102192358685a0b3b6431a3
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Sun Apr 15 14:55:10 2012 +0200
Fixed threading issues with commit model
libgitg/gitg-commit-model.vala | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libgitg/gitg-commit-model.vala b/libgitg/gitg-commit-model.vala
index 87aca7b..aefac70 100644
--- a/libgitg/gitg-commit-model.vala
+++ b/libgitg/gitg-commit-model.vala
@@ -59,7 +59,10 @@ public class CommitModel : Object
public void reload()
{
cancel();
- walk();
+
+ walk.begin((obj, res) => {
+ walk.end(res);
+ });
}
public uint size()
@@ -126,7 +129,7 @@ public class CommitModel : Object
});
}
- private void walk()
+ private async void walk()
{
Ggit.OId[] included = include;
Ggit.OId[] excluded = exclude;
@@ -134,6 +137,8 @@ public class CommitModel : Object
d_cancellable = new Cancellable();
uint limit = this.limit;
+ SourceFunc cb = walk.callback;
+
ThreadFunc<void*> run = () => {
if (d_walker == null)
{
@@ -226,12 +231,15 @@ public class CommitModel : Object
}
notify_batch(true);
+
+ cb();
return null;
};
try
{
d_thread = Thread.create<void*>(run, true);
+ yield;
}
catch
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]