[fpc-pascal] TThread.Synchronize() in shared library

Matthias Klumpp matthias at nlinux.org
Fri Apr 16 11:17:49 CEST 2010


Hello!
I have a serious problem with a shared lib and threads.
To fix a critical bug in my app, the shared library has to execute commands
asynchronous. To make the non-blocking API I use classes inherited from
TThread, which process serveral actions. Those threads have to submit data
back to the main thread of the application. (Status data, messages etc.) I
use callbacks for this. 
Those callback have to be synced with the main thread of the app which
makes use of my library. I tried to use Synchronize(), but it did not work.
(The thread hangs cause Synchronize() can't find the main thread)
I cannot move the threading part to the main application, it has to be done
inside of the lib cause of several other reasons.
Does someone know how I sync with the mainthread of the app which uses my
lib?
This would be really great!
Regards
   Matthias Klumpp



P.S: I use FPC 2.4.1 under Linux. If there's a Linux-only solution this
wouldn't be a problem cause the app will only run on Linux (at time).



More information about the fpc-pascal mailing list