Hi Jeff and others,
When one starts a transaction with the StartTransaction method of TIBTransaction, a TWriterThread is created
as a result of the call to MonitorHook.TRStart(Self).
This thread does not automatically destroy itself after terminating, but is destroyed in the finalization code of IBSQLMonitor.pas.
According to my understanding the finalization of a unit is only run after the main thread's message processing has ended.
It would seem then that calling
FWriterThread.Terminate;
FWriterThread.WaitFor;
during finalization (see CloseThreads) will cause deadlock. If my understanding of the source for WaitFor is correct, it will signal a message, but since message processing has ended it will never terminate.
Anyhow, deadlock occurs.
I suggest that we rather have the thread free itself when it terminates.
If you need more detailed information please email me at kevinn@korbitec.com
Thanks.
Kevin
I had some problem related to a deadlock.
I'm doing a "IBTransaction1.CommitRetaining;" to get back events posted on triggers with an TIBEvent component.
I had almost no code. Any idea? As I read, it could be related...