From 84f2126d148b78a5310378a243fd3bc822f467b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Laval?= Date: Mon, 20 Sep 2010 22:18:32 +0100 Subject: [PATCH] Fix possible race due to multiple concurrent assignement of the wait event in PendingCall. --- src/PendingCall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PendingCall.cs b/src/PendingCall.cs index 09e5e16..01d097e 100644 --- a/src/PendingCall.cs +++ b/src/PendingCall.cs @@ -39,7 +39,7 @@ public Message Reply conn.DispatchSignals (); } else { if (waitHandle == null) - waitHandle = new ManualResetEvent (false); + Interlocked.CompareExchange (ref waitHandle, new ManualResetEvent (false), null); // TODO: Possible race condition? while (reply == null)