[Lazarus] How to use critical sections to lookup database info in main thread?
Frank Church
vfclists at gmail.com
Sun Oct 2 21:58:24 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.
I am not sure if the database library code is faulty or looking up the
values in a thread is the problem
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?
The threads are run in a different module from the one with database lookup.
Should the CriticalSection be in DataModule containing the threads or in the
DataModule with the lookup?
Do the other forms running in the main thread also require the critical
section, or is that only for the stuff in the thread?
ie.
EnterCriticalSection(ModuleWithThreads.CriticalSection)
LookupDatabaseCode;
LeaveCriticalSection(ModuleWithThreads.CriticalSection);
--
Frank Church
=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111002/94d0640c/attachment-0002.html>
More information about the Lazarus
mailing list