[fpc-devel] Threads and alot of crap continued
Ales Katona
almindor at gmail.com
Wed Nov 8 11:26:16 CET 2006
You can call a callback in same thread, but since you can't ensure what
the callback does from your "lib" you can't make it threadsafe in any
way. Even if you put the callback itself into a "criticalsection" it
might eg: change some variable which was "just in use" by the main
thread, and once the callback finished the main thread booms.
This is an old problem, and not fixable by wishing it. If you want a
good async. timer, sure make one, but don't expect it to work safely by
magic. Make sure to inform users that certain things are simply not a
good idea to be done from their callbacks, or tell them to ensure
thread-safety in main thread too.
That's what I ment, it won't simply "just work without implications"
like TThread SEEMS to.
Ales
More information about the fpc-devel
mailing list