[Modify] Polish it

This commit is contained in:
sta 2016-04-10 15:20:21 +09:00
parent 3a0a661300
commit 0a31183ca7

View File

@ -136,11 +136,13 @@ namespace WebSocketSharp.Net
private static void complete (HttpListenerAsyncResult asyncResult) private static void complete (HttpListenerAsyncResult asyncResult)
{ {
asyncResult._completed = true; lock (asyncResult._sync) {
asyncResult._completed = true;
var waitHandle = asyncResult._waitHandle; var waitHandle = asyncResult._waitHandle;
if (waitHandle != null) if (waitHandle != null)
waitHandle.Set (); waitHandle.Set ();
}
var callback = asyncResult._callback; var callback = asyncResult._callback;
if (callback == null) if (callback == null)
@ -168,8 +170,7 @@ namespace WebSocketSharp.Net
? new HttpListenerException (995, "The listener is closed.") ? new HttpListenerException (995, "The listener is closed.")
: exception; : exception;
lock (_sync) complete (this);
complete (this);
} }
internal void Complete (HttpListenerContext context) internal void Complete (HttpListenerContext context)
@ -188,8 +189,7 @@ namespace WebSocketSharp.Net
_context = context; _context = context;
_syncCompleted = syncCompleted; _syncCompleted = syncCompleted;
lock (_sync) complete (this);
complete (this);
} }
internal HttpListenerContext GetContext () internal HttpListenerContext GetContext ()