[banshee] [Hyena] Add ThreadAssist.BlockingProxyToMain func
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [Hyena] Add ThreadAssist.BlockingProxyToMain func
- Date: Sat, 28 Nov 2009 00:26:00 +0000 (UTC)
commit e19b757ae3144defcf4f130fb7a74660e199741a
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri Nov 27 16:21:02 2009 -0800
[Hyena] Add ThreadAssist.BlockingProxyToMain func
.../Banshee.Services/Banshee.Base/ThreadAssist.cs | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs b/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs
index 9344230..43fad7c 100644
--- a/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs
+++ b/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs
@@ -69,6 +69,25 @@ namespace Banshee.Base
}
}
+ public static void BlockingProxyToMain (InvokeHandler handler)
+ {
+ if (!InMainThread) {
+ var reset_event = new System.Threading.ManualResetEvent (false);
+
+ Banshee.ServiceStack.Application.Invoke (delegate {
+ try {
+ handler ();
+ } finally {
+ reset_event.Set ();
+ }
+ });
+
+ reset_event.WaitOne ();
+ } else {
+ handler ();
+ }
+ }
+
public static void ProxyToMain (InvokeHandler handler)
{
if (!InMainThread) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]