Nikolai Zhubr
Wed, 27 Jan 2010 06:23:45 -0800
27.01.2010 15:30, Leonardo M. Ramé:
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 reliable regression-test for automated testing. On the other hand, verifying it all by hand is also not what I'd be dreaming of.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! Nikolai
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@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel