private void Process()
{
while (mRunning)
{
//Console.WriteLine("{0} waiting for work", Thread.CurrentThread.ManagedThreadId);
mCommandQueue.WaitForWork();
mCommandQueue.GetContext();
//Console.WriteLine("{0} got work", Thread.CurrentThread.ManagedThreadId);
if (mCommandQueue.Count != 0)
{
//Console.WriteLine("thread {0} processing query ", Thread.CurrentThread.ManagedThreadId);
AsyncMysqlCommand command = mCommandQueue.Dequeue();
mCommandQueue.NotifyEmpty();
mCommandQueue.ReleaseContext();
command.Command.Connection = mConnection;
try
{
command.Execute();
}
catch (MySqlException exception)
{
}
command.InvokeHandler();
//Console.WriteLine("{0} processing complete", Thread.CurrentThread.ManagedThreadId);
}
else
{
//Console.WriteLine("{0} nothing to do ", Thread.CurrentThread.ManagedThreadId);
mCommandQueue.ReleaseContext();
}
}
//Console.WriteLine("closing mysql connection..");
mConnection.Close();
Console.WriteLine("mysql connection closed");
}