private void CommandThread()
{
try
{
bool exitThread = false;
while (!exitThread)
{
_commandNotify.Wait();
_commandNotify.Reset();
lock (_commandQueueSync)
{
if (_commandQueue.Count == 0)
{
// No commands in queue, wait for queue to receive events
continue;
}
QueueItem item = _commandQueue[0];
_commandQueue.RemoveAt(0);
switch ((int) item.cmd)
{
case (int) PlaybackCommand.Stop:
StopCommand();
break;
case (int) PlaybackCommand.ExitThread:
exitThread = true;
break;
default:
Log.Error("BASS: CommandThread unknown command {0}", (int) item.cmd);
continue;
}
}
}
}
catch (Exception ex)
{
Log.Error("BASS: CommandThread exception {0}", ex);
}
}