[fpc-pascal] What's the status of RTL and IsMultiThreaded := True?
sysrpl at gmail.com
Sat Apr 13 11:12:06 CEST 2013
I did some Googling earlier tonight regarding using the RTL and threads
without creating a TThread class. I found some older results from this
mailing list such as...
Basically, what I want to know is "HOW DO I..." ensure the RTL memory
management is safe if multiple threads are running, but if a TThread class
is never instantiated. I am doing some work test/writing pascal demos for
SDL 2.0 and it creates threads for you, sometimes automatically, which can
call back user defined functions.
I've written a few example programs using just a program unit containing
"uses SDL2;" (SDL2.pas only imports functions from a SDL 2.0 dynamic
library) which play sounds, use force feedback controllers, accept touch
input ect, and should work natively on many devices (Windows, Linux,
Android, OSX, iOS, Raspberry Pi) with very little to no need for code
modification. But, I want to be proper and ensure things something like the
pascal memory manager works with GetMem and FreeMem (or for that matter all
other rtl routines) when the SDL sound mixer calls back some of my user
defined pascal function from a new thread SDL is managing.
My examples currently weigh in at about 25KB compiled and are quite
concise/understandable. I'd like to avoid the baggage of bringing in the
SysUtils and Classes units, creating a Classes.TThread, then destroying the
thread ... all to ensure the memory manager and the rest of the System unit
is aware multiple threads might be executing.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal