Hello,
I am developing MySQL client using libmysql.dll
I have insert records from queue on time based approach.

I am using thread :
DWORD WINAPI database_worker::InsertThread(LPVOID lpParam)
{
database_worker *pthis = static_cast<database_worker*>(lpParam);

string Insert;
while(pthis->_bInsertThread && !pthis->_bShutDown)
{
WaitForSingleObject(pthis->_insert_queue.m_hEvent,3000);
while(pthis->_insert_queue.Size() > 0 && pthis->_bInsertThread && !pthis->_bShutDown)
{
Insert = pthis->_insert_queue.Pop();
pthis->exec_query(&Insert);
}
}

return 0;
}

exec_query method contains call to mysql_query(&_sql_client->_MySQL, Insert->c_str()),
errors checkups etc.
Application fails in exec_query with error messages:

database_worker::exec_query : mysql - [2013], Lost connection to MySQL server during query
mysql - [2006], MySQL server has gone away
mysql - [2006], MySQL server has gone away

There are a lot of reasons for - [2013], Lost connection to MySQL server during query
but there " timeout and packet_size issue" is not my case.
Queries are correct, the same queries complete successfully when I call "exec_query" not from thread..
This is misterious thing, ghave you any opinion?
Thanks a lot