Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1031843 // ExternalMutex

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (47L/1K).

sclass ExternalMutex /*implements AutoCloseable*/ {
  int referenceCount;
  
  void incRefCount {
    referenceCount++;
    ifdef ExternalMutex_debug
      print(toStringWithIdentity(this) + " referenceCount++ => " + referenceCount);
    endifdef
  }
  
  int decRefCount() {
    --referenceCount;
    ifdef ExternalMutex_debug
      print(toStringWithIdentity(this) + " referenceCount-- => " + referenceCount);
    endifdef
    ret referenceCount;
  }
  
  /*public void close {
    var map = externalMutexMap();
    synchronized(map) {
      if (--referenceCount == 0)
        map.remove(this);
    }
  }*/
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031843
Snippet name: ExternalMutex
Eternal ID of this version: #1031843/6
Text MD5: d4f4fa2e7aacea6e56ddd0a1093981d2
Transpilation MD5: 62bd41dcfd997f3f8b56ab703dd61ec1
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:03:52
Source code size: 635 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 153 / 310
Version history: 5 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)