Modified a few for Example1

This commit is contained in:
sta
2014-10-02 16:16:15 +09:00
parent e80633b73b
commit 0fc7c82e70
4 changed files with 82 additions and 81 deletions

View File

@@ -35,8 +35,9 @@ namespace Example1
Console.WriteLine (msg);
#endif
}
else
else {
Thread.Sleep (500);
}
}
_waitHandle.Set ();
@@ -45,19 +46,17 @@ namespace Example1
public int Count {
get {
lock (_sync) {
lock (_sync)
return _queue.Count;
}
}
}
private NotificationMessage dequeue ()
{
lock (_sync) {
lock (_sync)
return _queue.Count > 0
? _queue.Dequeue ()
: null;
}
}
public void Close ()
@@ -69,10 +68,9 @@ namespace Example1
public void Notify (NotificationMessage message)
{
lock (_sync) {
lock (_sync)
if (_enabled)
_queue.Enqueue (message);
}
}
void IDisposable.Dispose ()