Hi:
Try mutex instead critical section, mutexes have the advantage that can be
accessed by the threads of different processes. Critical section is often used
to protect a shared resource in order to synchronize the access order and (one
of the most important restriction for me) you cannot have a wait with a timeout
like mutex or semaphore,
Best regards,
Alex
----- Original Message -----
From: "Warren Young" <mysqlpp@stripped>
To: "MySQL++ Mailing List" <plusplus@stripped>
Sent: Monday, June 02, 2008 11:00 AM
Subject: Re: mysqlpp::Query Issue
> onlyreply-sql@stripped wrote:
>> I think the problem was with
>> default constructor on query object not properly being initialized.
>> Once I initialized sqlquery object like this ... mysqlpp::Query
>> sqlquery = commonDBCon.query(); , the problem went away
>
> Are you saying that it doesn't work when you pass the query string to
> Connection::query()? The examples do this in several places successfully, and
> this is an intended feature, so if you can show an instance where it doesn't
> work, I'd be interested in seeing compilable code that shows it.
>
>> LeaveCriticalSection(&m_csDBAccess);
>
> Not MySQL++ related, but this is highly error-prone code. You should be using
> an RAII pattern here to make sure that all code paths that exit the function
> release the critical section mutex. It appears fine now, but future
> maintenance could add a code path that accidentally doesn't release the mutex.
> See the code for MySQL++'s Transaction class -- it's short -- for the general
> idea.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=1
>
>