hopefully fix mutex.release
This commit is contained in:
parent
9aa05b2d15
commit
9308b9495f
|
@ -1,6 +1,6 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.0.2</Version>
|
<Version>1.0.0.3</Version>
|
||||||
<Description>A tesses webserver port of https://github.com/praeclarum/Ooui</Description>
|
<Description>A tesses webserver port of https://github.com/praeclarum/Ooui</Description>
|
||||||
<PackageTags>Ooui;UI;CrossPlatform</PackageTags>
|
<PackageTags>Ooui;UI;CrossPlatform</PackageTags>
|
||||||
<PackageIcon>Icon.png</PackageIcon>
|
<PackageIcon>Icon.png</PackageIcon>
|
||||||
|
|
|
@ -13,6 +13,17 @@ namespace Ooui
|
||||||
|
|
||||||
protected readonly List<Message> queuedMessages = new List<Message> ();
|
protected readonly List<Message> queuedMessages = new List<Message> ();
|
||||||
|
|
||||||
|
protected readonly System.Threading.SemaphoreSlim slimSema=new System.Threading.SemaphoreSlim(0,1);
|
||||||
|
|
||||||
|
protected void LockQueue()
|
||||||
|
{
|
||||||
|
slimSema.Wait();
|
||||||
|
}
|
||||||
|
protected void UnlockQueue()
|
||||||
|
{
|
||||||
|
slimSema.Release();
|
||||||
|
}
|
||||||
|
|
||||||
protected readonly bool disposeElementAfterSession;
|
protected readonly bool disposeElementAfterSession;
|
||||||
readonly Action<string, Exception> errorLogger;
|
readonly Action<string, Exception> errorLogger;
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace Ooui
|
||||||
//
|
//
|
||||||
var messagesToSend = new List<Message> ();
|
var messagesToSend = new List<Message> ();
|
||||||
|
|
||||||
lock (queuedMessages) {
|
LockQueue();
|
||||||
messagesToSend.AddRange (queuedMessages);
|
messagesToSend.AddRange (queuedMessages);
|
||||||
queuedMessages.Clear ();
|
queuedMessages.Clear ();
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ namespace Ooui
|
||||||
//Console.WriteLine ("TRANSMIT " + json);
|
//Console.WriteLine ("TRANSMIT " + json);
|
||||||
sendMsg?.Invoke(WebSocketMessage.Create(json));
|
sendMsg?.Invoke(WebSocketMessage.Create(json));
|
||||||
//task = webSocket.SendAsync (outputBuffer, WebSocketMessageType.Text, true, token).ConfigureAwait (false);
|
//task = webSocket.SendAsync (outputBuffer, WebSocketMessageType.Text, true, token).ConfigureAwait (false);
|
||||||
}
|
UnlockQueue();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch ( System.AggregateException ex)
|
catch ( System.AggregateException ex)
|
||||||
|
|
Loading…
Reference in New Issue