Subject | Multithread memory corruption... |
---|---|
Author | Calin Pirtea |
Post date | 2010-10-03T12:24:36Z |
Hi Jason,
I'm using IBO 4.8.7 and we managed to isolate a multithreading problem in IB_Session.pas.
Isc_* hooks are not thread safe in case they are modified. Normally they point directly to dll_* hooks, however if someone uses the monitor then these hooks are overridden to point to monitor functions which are totally not thread safe.
Our fix was to place a threadvar declaration just above
// Hooks for monitor interrupt to be put in.
isc_attach_database: Tisc_attach_database;
We prefer to have the monitor running only on the current thread rather than all threads. The monitor is still not thread safe but it can be used safely for one thread leaving the other threads running without corruption.
I hope this helps,
Calin Pirtea
Communicare Development Team
[Non-text portions of this message have been removed]
I'm using IBO 4.8.7 and we managed to isolate a multithreading problem in IB_Session.pas.
Isc_* hooks are not thread safe in case they are modified. Normally they point directly to dll_* hooks, however if someone uses the monitor then these hooks are overridden to point to monitor functions which are totally not thread safe.
Our fix was to place a threadvar declaration just above
// Hooks for monitor interrupt to be put in.
isc_attach_database: Tisc_attach_database;
We prefer to have the monitor running only on the current thread rather than all threads. The monitor is still not thread safe but it can be used safely for one thread leaving the other threads running without corruption.
I hope this helps,
Calin Pirtea
Communicare Development Team
[Non-text portions of this message have been removed]