Show quoted text 8 lines
Hi,
I have form and thread in DLL. It seems that Synchronize() doesn't work.
Thread is hanging on first Synchronize().
It works only when I open form in ShowModal. I debug this and only difference
between Show() is that ShowModal call WidgetSet.AppProcessMessages in loop. I
can rewrite my code to use critical sections but what if this doesn't work
too and I will waste my time?
You must call CheckSynchronize at regular intervals in the main thread. WidgetSet.AppProcessMessages does this for you, that is why it works during ShowModal()
Note that it is not enough to do this in the main application binary; That will check for synchronisation with threads created in the main application. To synchronize threads created in the DLL you must explicitly export a call from your DLL which calls CheckSynchronize, and this call must be called from the main program at regular intervals.
Michael.