[banshee] Threading: simplify couple of method calls to ThreadAssist class
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Threading: simplify couple of method calls to ThreadAssist class
- Date: Tue, 21 Jan 2014 19:35:59 +0000 (UTC)
commit 99466b14e5473e5a5357934940e7df61e93a02bd
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Tue Jan 21 20:35:50 2014 +0100
Threading: simplify couple of method calls to ThreadAssist class
ProxyToMain() and SpawnFromMain() already check .InMainThread
so this simplification does not mean only less code (as it uses
lambdas instead of delegates, too), but also a micro-optimization.
.../Banshee.MediaEngine/PlayerEngine.cs | 8 +-------
src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs | 8 ++------
2 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
index de0f525..85a4ea9 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
@@ -220,13 +220,7 @@ namespace Banshee.MediaEngine
pending_track = null;
}
- if (ThreadAssist.InMainThread) {
- RaiseEventChanged (args);
- } else {
- ThreadAssist.ProxyToMain (delegate {
- RaiseEventChanged (args);
- });
- }
+ ThreadAssist.ProxyToMain (() => RaiseEventChanged (args));
}
private void RaiseEventChanged (PlayerEventArgs args)
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs b/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
index 38f5a43..08d0ea9 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
@@ -325,13 +325,9 @@ namespace Banshee.Dap
public void Sync ()
{
- if (ThreadAssist.InMainThread) {
- ThreadAssist.SpawnFromMain (delegate {
- sync_limiter.Execute ();
- });
- } else {
+ ThreadAssist.SpawnFromMain (delegate {
sync_limiter.Execute ();
- }
+ });
}
private void RateLimitedSync ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]