multithreading - Synchronize() hangs up the thread -


i'm writing dll library in delphi multiple threads created it. let me describe problem step step. i'm sorry lengthy description in advance :-(.

let's forget library while. created windows application going present views several cameras. created window meant show view single camera , contains timage control. there thread (a tthread descendant) downloads current image camera every couple of milliseconds , assigns timage control of window (using synchronize() method). application creates several instances of window on startup (with separate thread each of them), can see live view several cameras @ once. what's more, viewing windows parented main application window, appear within it.

everything worked fine until decided put 2 windows dll library. found necessary reasons, not important now. created new dll library, added existing main window , camera-view window project , exported function creates , returns instance of main window. when main window created, creates several camera-view windows, making parent.

then, testing purposes, created app imports above mentioned dll function library , calls @ startup instance of main window; shows on screen (in non-modal state).

when started app came out couldn't single image camera then. when debugged it, noticed when thread calls synchronize() method, hangs forever. didn't happen before putting both windows dll.

and problem. honest, first approach libraries have had through many other problems far. might wonder why use windows instead of frames... whenever created instance of tframe in dll, exception saying "the control xxx not have parent window". did not know used windows instead :-(.

could please tell me synchronization problem? main thread not seem blocked in way when application started accepts clicking buttons etc. problem then?

please, help!

thank in advance!!

when call tthread.synchronize thread , method pointer added global synclist: tlist in classes.pas. in main exe's tapplication.idle routine calls checksynchronize, checks synclist, it's going check version in exe instead of 1 in dll. end result, synchronized methods never called.

the easiest fix switch dlls packages, eliminate duplicate synclist.

another approach override exe's application.onidle callback, , call dll's checksynchronize manually. need application though, since dll have application object too, , 1 won't work.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -