Indy FTP 警告:Only one TIdAntiFreeze can be active in an application
> Should I use a AntiFreeze component on every form I have a TIdTCPClient
> component? Or is one enough to handle the whole Application?
One is enough. According to the Indy help file,
--------
Only one TIdAntiFreeze can be active in an application. If another
instance already exists, an exception is raised.
--------
Note that if you have multiple TIdTCPClient objects connected at the
same time, and you call ReadXXX twice or more often (e. g. on a button
click event) in the main thread context, then the last called ReadXXX
will return first, blocking the other ReadXXX requests even if they
could return data. This is because of the nature of the AntiFreeze
mechanism.
To avoid this effect, use a dedicated reader thread for each connection
instead of AntiFreeze. There is a TIdTCPClient descendant with its own
reader thread, firing an event when data arrive, at
http://come.to/delphi-bits .
-Michael
TIdAntiFreeze = class(TIdAntiFreezeBase)
Only one TIdAntiFreeze can be active in an application. If another instance already exists, an exception is raised. TIdAntiFreezeBase uses the global variable GAntiFreeze, declared in the TIdAntiFreezeBase unit, to determine if another instance has already been created.
Note: GAntiFreeze is not assigned if an instance is added in the form designer (during design time).
Note: The TIdAntiFreeze.pas unit must NOT appear in the uses clause of any Indy or descendant unit. This unit is linked in an application when the component is placed on a Form. This is done to preserve isolation from the Forms.pas and QForms.pas units.
procedure Process; override;
Note: Due to the differences in message dispatching, Process does not use or inspect ApplicationHasPriority on the Linux Platform; Process simply calls Application.ProcessMessages.
Note: The TIdAntiFreeze.pas unit must NOT appear in the uses clause of any Indy or descendant unit. This unit is linked in an application when the component is placed on a Form. This is done to preserve isolation from the FORMS.PAS and QForms.pas units.