Emit WebAsyncResult's callback on same thread on sync completion.
authorMartin Baulig <martin.baulig@xamarin.com>
Thu, 25 Oct 2012 22:57:25 +0000 (00:57 +0200)
committerMartin Baulig <martin.baulig@xamarin.com>
Thu, 25 Oct 2012 23:00:03 +0000 (01:00 +0200)
This fixes System.Net.Http.HttpClientTest.Send_Content_Put ().

mcs/class/System/System.Net/WebAsyncResult.cs

index a97c1da97ad8b84239ea9c9c6f4d03adbfe4e262..7cc9d5e1d8bfca35b1ff1e4cc3357efcde210204 100644 (file)
@@ -139,7 +139,10 @@ namespace System.Net
                {
                        if (!callbackDone && cb != null) {
                                callbackDone = true;
-                               ThreadPool.QueueUserWorkItem (CB, null);
+                               if (synch)
+                                       cb (this);
+                               else
+                                       ThreadPool.QueueUserWorkItem (CB, null);
                        }
                }