[fpc-devel] FCL Thread-safety
Nikolai Zhubr
zhubr at mail.ru
Wed Jan 27 15:27:28 CET 2010
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 reliable
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!
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
>
More information about the fpc-devel
mailing list