Am Sat, 08 Feb 2014 16:46:25 +0000 schrieb "Stanislav Blinov" <[email protected]>:
> Also, on a related note, is there any benefit in having core.sync > primitives not final? What would be a use case to inherit from > e.g. Mutex or Condition? GC does that with Mutex, but only to > devirtualize all methods :) > > Maybe we should also consider making them final along the way? I did once inherit from Mutex to add a reentrancy counter. This can be used in a Logger, to prevent one thread to endlessly recurse into logging functions. Like when logging causes and error that is logged which causes the same error again, which is logged, ... If the reentrancy counter is > 1 after locking, you can special case around that and just print something to stderr directly or delegate to a less error prone logger. -- Marco
