From 545956ffe39c96c9476c30bca1e0d09e8879b11a Mon Sep 17 00:00:00 2001 From: jbevain Date: Tue, 21 Jul 2009 16:23:42 +0000 Subject: [PATCH] 2009-07-21 Jb Evain * ThreadPool.cs: avoid an unecessary method call when not running in moonlight. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@138313 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/corlib/System.Threading/ChangeLog | 5 +++++ class/corlib/System.Threading/ThreadPool.cs | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/class/corlib/System.Threading/ChangeLog b/class/corlib/System.Threading/ChangeLog index 149619c328..dba577731b 100644 --- a/class/corlib/System.Threading/ChangeLog +++ b/class/corlib/System.Threading/ChangeLog @@ -1,3 +1,8 @@ +2009-07-21 Jb Evain + + * ThreadPool.cs: avoid an unecessary method call when not running + in moonlight. + 2009-07-20 Jb Evain * Thread.cs: use the moonlight specific thread start diff --git a/class/corlib/System.Threading/ThreadPool.cs b/class/corlib/System.Threading/ThreadPool.cs index b0737b2bd2..9dc755dcaf 100644 --- a/class/corlib/System.Threading/ThreadPool.cs +++ b/class/corlib/System.Threading/ThreadPool.cs @@ -95,7 +95,9 @@ namespace System.Threading { public static bool QueueUserWorkItem (WaitCallback callBack, object state) { +#if NET_2_1 && !MONOTOUCH callBack = MoonlightHandler (callBack); +#endif IAsyncResult ar = callBack.BeginInvoke (state, null, null); if (ar == null) return false; @@ -217,9 +219,9 @@ namespace System.Threading { throw new NotImplementedException (); } +#if NET_2_1 && !MONOTOUCH static WaitCallback MoonlightHandler (WaitCallback callback) { -#if NET_2_1 && !MONOTOUCH return delegate (object o) { try { callback (o); @@ -228,9 +230,7 @@ namespace System.Threading { Thread.MoonlightUnhandledException (ex); } }; -#else - return callback; -#endif } +#endif } } -- 2.11.4.GIT