On Fri, 16 Apr 2010, Matthias Klumpp wrote:

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).

Set the thread manager of the library to the main application thread
manager. That should hopefully work. But it is not guaranteed; there
are many issues with libraries and threads under linux.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to