[Lazarus] RE : How to use critical sections to lookup database info inmain thread?
vfclists at gmail.com
Mon Oct 3 12:28:22 CEST 2011
2011/10/3 Ludo Brands <ludo.brands at free.fr>
> I changed some values in some threaded code from using constants to
> looking up the values from a database and I have been getting errors all the
> time, that values which are present in the database are missed by the
> sequential scan. I have been getting some Externa SIGSEGVs a lot.
> The minimum requirement for multithreaded db access is to use a separate db
> connection for every thread and transaction isolation.
> I am not sure if the database library code is faulty or looking up the
> values in a thread is the problem
> Some database client libraries have problems with multithreading or have
> threadsafe versions (fe. libmysql.dll is not threadsafe in the standard
> The database lookup code is in a data module running in the main thread. Do
> I have to use a critical section in data module containing the threads to
> the database lookup?
> No. That is trying to solve the problem in the wrong place.
If I put a TCP component such as an Indy http component on that data module,
and get all the lookups to be done over the http socket, is that likely to
fix the problem, rather than calling the database lookup code in the data
module directly from the threads?
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Lazarus