-
Notifications
You must be signed in to change notification settings - Fork 0
Constants
Stephen Crowley edited this page Mar 31, 2023
·
2 revisions
the Real and Complex types implement the Lockable interface which has a method called lock that calls the POSIX mprotect function to designate the memory region pointed to be the type as read-only which will cause a crash if anything attempts to modify the variables contents.
This is useful for tracking down problems where something like RealConstants or ComplexConstants is being modified by some buggy code, or an input variable is being modified where it shouldn't be. This is a high-performance way to implement immutability at a level closer to the hardware in Java