View Issue Details

IDProjectCategoryView StatusLast Update
0036699FPCCompilerpublic2020-06-07 18:07
ReporterNoName Assigned To 
Status newResolutionopen 
Summary0036699: Add TMonitor record
DescriptionFor Delphi compatibility the TMonitor ( should be added.
TagsNo tags attached.
Fixed in Revision
Attached Files


Thaddy de Koning

2020-02-15 09:57

reporter   ~0121104

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.

Sven Barth

2020-02-15 20:42

manager   ~0121112

@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.

Michael Van Canneyt

2020-06-07 18:07

administrator   ~0123312

Changing the category to Compiler, because of the additional pointer field.
TMonitor is a pain, I don't know who thought of this. Probably again some .Net compatibility stuff :/
I don't think that adding a mapping is a good idea, since it would seriously impact speed.

Issue History

Date Modified Username Field Change
2020-02-13 22:36 NoName New Issue
2020-02-15 09:57 Thaddy de Koning Note Added: 0121104
2020-02-15 20:42 Sven Barth Note Added: 0121112
2020-06-07 18:07 Michael Van Canneyt Category RTL => Compiler
2020-06-07 18:07 Michael Van Canneyt FPCTarget => -
2020-06-07 18:07 Michael Van Canneyt Note Added: 0123312