[Lazarus] RE : How to use critical sections to lookup database info inmain thread?

Ludo Brands ludo.brands at free.fr
Mon Oct 3 08:37:28 CEST 2011


 

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
version). 

 
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.
 
Ludo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111003/c9403cde/attachment-0003.html>


More information about the Lazarus mailing list