[fpc-devel] FCL Thread-safety
Leonardo M. Ramé
martinrame at yahoo.com
Wed Jan 27 15:49:06 CET 2010
Well, I had to create a simple testing application that generates random XML messages and stress-test the daemon.
About Zeos, my app does not compiles against the svn version, but a copy of an approved (by me!) version. Every couple of months, I get the latest version, then compile and test, if this works ok, I copy the whole directory of Zeos and place it in my app's dir tree, this tree is a frozen version of Zeos. This way, I'm not concerned about changes in the libraries.
Leonardo M. Ramé
--- On Wed, 1/27/10, Nikolai Zhubr <zhubr at mail.ru> wrote:
> From: Nikolai Zhubr <zhubr at mail.ru>
> Subject: Re: [fpc-devel] FCL Thread-safety
> To: fpc-devel at lists.freepascal.org
> Date: Wednesday, January 27, 2010, 12:27 PM
> 27.01.2010 15:30, Leonardo M. Ramé:
> > I can confirm FCL-XML is thread safe, at least in FPC
> 2.5.1, also
> > Zeos as far as you create a new connection to the
> database inside
> > each thread.
> > I'm using both libraries in a multithreaded daemon
> that receives an
> > XML file via socket, then connects to a Postgres
> database using
> > Zeos.
> Thank you very much! That is very similar to what I'll be
> doing, except
> that I just dont use XML. Yes, I'll create 1 connector per
> thread of course.
> The only concern then is how to ensure that thread-safety
> is not
> (ocasionally) destroyed with some future FCL and/or zeoslib
> versions. It
> somehow seems quite uneasy to design a simple and yet
> regression-test for automated testing. On the other hand,
> verifying it
> all by hand is also not what I'd be dreaming of.
> Thank you!
> > While developing this, the first issue was many
> database deadlocks,
> > and transaction problems caused because I was sharing
> a global
> > database connection, the solution was creating an
> instance of the
> > database connector in the Thread constructor, and
> destroy it in the
> > Thread destructror. Regarding the FCL-XML, I was using
> an old version
> > based on AVLTree, and found it have many problems when
> working within
> > threads, all of them solved after upgrading to the
> latest version.
> > Leonardo M. Ramé http://leonardorame.blogspot.com
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel