On Fri, 3 May 2019, J. Gareth Moreton wrote:

This is something I've been thinking about for a while, and I wonder how practical it is or if it's a good idea - the ability to mark specific routines as thread-safe with a directive named "safe" or "threadsafe".

By telling the compiler that the procedure (or maybe a whole class) is thread-safe, you are telling it that you can guarantee that any objects, fields or global variables that you access are guaranteed to not suddenly change mid-routine (because another thread has modified it).  This would allow the compiler to move commonly-accessed fields into local registers or the stack for faster access, especially if the fields are only read and not written, since they'll be guaranteed to contain a constant value.

What about exceptions ?

Michael.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to