Den 17-08-2014 20:03, Sergio Flores skrev:
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?
That is correct.
I'm using FPC 2.6.1 for Android compilation, maybe this was fixed in later versions?
I'm not sure but you should probably try a newer version, maybe build from trunk. 2.6.1 is old as far as I remember.
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to