[fpc-devel] Threads in Android

Sergio Flores relfos at gmail.com
Sun Aug 17 20:03:13 CEST 2014


I'm trying to use threads in Android, but it seems they are not working yet
in FPC?

I tried two approachs, using FPC TThread and using pthreads, none would
work.

Using TThread requires including cthreads unit right?
But including this unit makes the app imediately close at startup,
silently, with nothing in the log except a message saying the process died.

Not including cthreads makes the app thrown an exception when creating a
new thread, as expected. ("cannot create semaphore" or something like that).

I tried to use pthreads directly instead. However allocating any memory
inside the new thread crashes the app imediately (The stack shows that the
crash was in the cmem unit).
I guess some setup code has to called at the thread startup to allow the
mem manager to work correctly?

I'm using FPC 2.6.1 for Android compilation, maybe this was fixed in later
versions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140817/11493645/attachment.html>


More information about the fpc-devel mailing list