Modified a few for Example

This commit is contained in:
sta
2014-10-01 16:42:40 +09:00
parent 6ff6b0485f
commit e80633b73b
2 changed files with 38 additions and 28 deletions

View File

@@ -35,8 +35,9 @@ namespace Example
Console.WriteLine (msg);
#endif
}
else
else {
Thread.Sleep (500);
}
}
_waitHandle.Set ();
@@ -45,19 +46,17 @@ namespace Example
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 Example
public void Notify (NotificationMessage message)
{
lock (_sync) {
lock (_sync)
if (_enabled)
_queue.Enqueue (message);
}
}
void IDisposable.Dispose ()