View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0036699||FPC||RTL||public||2020-02-13 22:36||2020-02-15 20:42|
|Product Version||Product Build|
|Target Version||Fixed in Version|
|Summary||0036699: Add TMonitor record|
|Description||For Delphi compatibility the TMonitor (http://docwiki.embarcadero.com/Libraries/Rio/en/System.TMonitor) should be added.|
|Tags||No tags attached.|
|Fixed in Revision|
This also need implementation, not just declaration.
It also depends on two features of Delphi that are not implemented in FreePascal yet:
- Volatile as attribute instead of intrinsic (Documented that this will be resolved in the future)
- Anonymous methods. (Status unknown)
Also note that the TMonitor implementation of Delphi has a myriad of open and serious bugs, even in 10.3 Rio. See their bugtracker.
Although I agree it should be implemented at some point it is not that easy.
@Thaddy: you're wrong on both accounts.
The Volatile attribute can easily be handled by using the Volatile intrinsic for each read and write access to FLockCount.
I don't see any use of anonymous functions in the declaration of TMonitor, thus even if Delphi's implementation should use them internally they are not strictly necessary and can be worked around (which would probably be for the best as anonymous functions are rather heavy weight and TMonitor is supposed to be more lightweight).
The main annoyance of TMonitor is that it adds an additional pointer sized field to each TObject instance. Though that *could* be worked around by storing a mapping between instances and monitors in a map as the whole GetMonitor and friends stuff of TMonitor is declared as private.