[fpc-devel] weak referencing (was Suggestion:.....)

Sven Barth pascaldragon at googlemail.com
Mon Sep 22 19:24:42 CEST 2014


Am 22.09.2014 17:33 schrieb "Peter Popov" <ppopov at hotmail.com>:
> I will add another comment to the race condition issues: they are easily
avoided by a single line assembly atomic inc/dec. It however will not
resolve performance issues where a certain function assigns classes
references left and right and there are multiple threads. The fact that you
can easily protect it does not mean that you will retain parallel
efficiency. Thread-syncing should be left to the programmer to optimize.

Of course the reference count changing would use atomic operations (in
Pascal implemented by the Interlocked* group of functions) just as it is
done for strings, arrays and interfaces. Thuse there would be no need to
worry about race conditions regarding the reference counting, only for the
class logic itself which is the developer's job anyway.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140922/0eaf84b9/attachment.html>


More information about the fpc-devel mailing list