Bug 17691 – core.mutex.Mutex : {lock,unlock} should be @nogc
Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-26T01:32:00Z
Last change time
2017-07-26T05:41:45Z
Assigned to
nobody
Creator
greensunny12
Comments
Comment #0 by greensunny12 — 2017-07-26T01:32:35Z
Their underlying implementations are already @nogc.
Comment #1 by petar.p.kirov — 2017-07-26T05:41:45Z
Since those functions are virtual, adding any attribute to them is breaking change, because it adds additional requirements to derived classes.
New code that doesn't need to use derived classes, should prefer the `final` alternatives (lock_nothrow, tryLock_nothrow and unlock_nothrow). This violates the "open" part of OCP, so a valid, though probably unrelated to your problem, enhancement request is to create a class derived from Mutex that has all the attributes, but allows those methods to be overridden.