Re: TIdSync in DLL hangs

Giganews Newsgroups
Subject: Re: TIdSync in DLL hangs
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Thu, 19 Apr 2007

"Gordon Kästner" <Meta7…@arcor.de> wrote in message
news:3789689EED22E340Meta7…@arcor.de...

> I've a problem using TIdSync in a DLL - it hangs when the
> host app will free the library.

When is the host freeing the DLL?  TIdSync relies on
TThread.Synchronize(), which relies on the main thread message queue.
A hang would suggest that the main queue is no longer running.

> In the finalization block in IdSync.pas TIdNotify.FreeThread is
> called which waits for - I don't know what...

It is waiting for the internal notification thread to terminate, which
it won't be able to if any of the pending notifications are hung on
Synchronize().

> Is it not possible at all to use TIdSync in DLLs?

Yes it is, provided that the DLL and Host are built with runtime
packages so that they share a single sync list, and that the Host's
main message queue is running for the entire time that the DLL is
loaded.

Gambit

Replies

In response to

TIdSync in DLL hangs posted by Gordon_Kästner on Thu, 19 Apr 2007