9 messages in com.mysql.lists.plusplusRe: problems in ConnectionPool
FromSent OnAttachments
Jonathan Wakely22 Dec 2007 08:07.patch
Jonathan Wakely22 Dec 2007 12:42.patch
Jonathan Wakely22 Dec 2007 13:55 
Warren Young26 Dec 2007 19:41 
Warren Young26 Dec 2007 19:53 
Jonathan Wakely27 Dec 2007 14:16.cpp
Jonathan Wakely27 Dec 2007 14:20 
Warren Young28 Dec 2007 01:21 
Warren Young03 Jan 2008 10:58 
Subject:Re: problems in ConnectionPool
From:Jonathan Wakely (mys@kayari.org)
Date:12/22/2007 12:42:55 PM
List:com.mysql.lists.plusplus
Attachments:

On 22/12/2007, Jonathan Wakely <mys@kayari.org> wrote:

2) When you remove a connection from the pool_ list it seems to be leaked. My suggestion is to add a pure-virtual ConnectionPool::destroy() which the derived class must implement to free the connection.

If I'm right about this, ~ConnectionPool() should call destroy() on each element of pool_.

Except that it can't, because the derived class destructor will already have run and the pure virtual destroy() can't be called.

This means the derived destructor is required to destroy everything in pool_, so this revised patch adds a clear_pool() member which derived classes must call before the base ~ConnectionPool dtor runs.

This patch also uses STL algorithms to find old/unused connections in grab().

I'm now not sure about if or when last_used should be reset. The only time you really know the connection is fresh is at creation.

Jon