Libraryless. Click here for Pure Java version (3296L/18K).
// TODO: either put ExternalMutex in JavaX // or make externalMutexMap local static IAutoCloseableF0 tempExternalMutexFor(O o) { var map = externalMutexMap(); synchronized(map) { ExternalMutex mutex = map.get(o); if (mutex == null) map.put(o, mutex = new ExternalMutex); var _mutex = mutex; mutex.incRefCount(); ret new IAutoCloseableF0 { public O get() { ret _mutex; } public void close { synchronized(map) { if (_mutex.decRefCount() == 0) map.remove(o); } } }; } }
Began life as a copy of #1031844
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1031845 | 
| Snippet name: | tempExternalMutexFor | 
| Eternal ID of this version: | #1031845/9 | 
| Text MD5: | 28324940aa39091510c5b31dc6bf5c7e | 
| Transpilation MD5: | 106e4b5a388dc99f87e3bc457eeccfd9 | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2021-07-16 06:02:51 | 
| Source code size: | 578 bytes / 21 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 390 / 509 | 
| Version history: | 8 change(s) | 
| Referenced in: | [show references] |