ILockable/TLockable/Lockable. Similar to IManaged in Spring4D, but provides a Locked interface.
Posted by jpluimers on 2019/04/10
Had to use this to start solving threading issues in a project I inherited a while ago in a temporary way before doing a huge refactoring. Will likely need it in the future as well: ILockable/TLockable/Lockable. Similar to IManaged in Spring4D, but provides a Locked interface..
ILockable/TLockable/Lockable. Similar toIManaged(nowIShared) in Spring4D, but provides aLockedinterface.Note this is very inefficient, but can be practical as a shotgun approach to start solving the mess when you inherit a project that has the “I know, I’ll use threads!” approach in it.
Replace the resource typed
TNeedsLockthat needs protection with aILockable<TNeedsLock>, then route all references via a call to theLocked()()call to it.
If you need a simpler approach, then use [WayBack] Interfaced monitor lock — Bitbucket by Stefan Glienke.
–jeroen
https://gist.github.com/jpluimers/c5123c2f928f30e69a737dabb721dff6






Leave a Comment