[Timer] Use static CB for invoking timer callbacks.
[mono.git] / mcs / class / corlib / System.Threading / SynchronizationContext.cs
index d4ddaa432c2df661b57692b7869e5bad44d8daf8..cb7369fb0ff1aa3179c45b56c47beb95d5e30154 100644 (file)
@@ -26,8 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System.Runtime.ConstrainedExecution;
 using System.Runtime.InteropServices;
 
@@ -51,7 +49,13 @@ namespace System.Threading
                
                public static SynchronizationContext Current
                {
-                       get { return currentContext; }
+                       get {
+#if NET_2_1
+                               if (currentContext == null)
+                                       currentContext = new SynchronizationContext ();
+#endif
+                               return currentContext;
+                       }
                }
 
                public virtual SynchronizationContext CreateCopy ()
@@ -87,6 +91,14 @@ namespace System.Threading
                        currentContext = syncContext;
                }
 
+#if NET_2_1
+               [Obsolete]
+               public static void SetThreadStaticContext (SynchronizationContext syncContext)
+               {
+                       currentContext = syncContext;
+               }
+#endif
+
                [MonoTODO]
                protected void SetWaitNotificationRequired ()
                {
@@ -111,5 +123,3 @@ namespace System.Threading
                }
        }
 }
-
-#endif